Coder Social home page Coder Social logo

esjsonformat-xcode's Introduction

ESJsonFormat-Xcode

将JSON格式化输出为模型的属性    个人活动范围>Weibo-EnjoySR

写在之前的注意

  • JSON中的key对应的value为Null的话会格式化成NSString类型
  • 格式化之前光标放在你需要添加属性的地方
  • 如果不输出到文件,RootClass需要自己手动创建,插件只负责RootClass里面的属性生成
  • 生成的 MJExtension 框架中objectClassInArray方法(类方法)

####怎么安装:

方式1:下载-Xcode打开-Command+B-重启Xcode

方式2:通过Alcatraz安装,搜索 ESJsonFormat

方式3:下载-解压plugin文件夹中zip到~/Library/Application Support/Developer/Shared/Xcode/Plug-ins-重启Xcode

####怎么使用:

Window-ESJsonFormat-输入Json-Enter OR 快捷键(Control+Shift+J)-输入JSON-Enter

Screenshot

关于设置:

Screenshot

打开方式:Xcode菜单-Window-ESJsonFormat-Setting

  • 1)是否生成的 MJExtension 框架中objectClassInArray方法(类方法,默认勾选)
  • 2)是否格式化输出泛型(Xcode 7 及之后才有效,默认勾选)
  • 3)是否输出到文件(如果勾选,不用自己新建 RootClass。默认不勾选)
  • 4)key为id关键字的话是否大写(默认不勾选)
  • 注:输出到文件的内容还需要添加什么的可以联系我,人个认为不用像 JSON Accelerator 一样生成字典转模型的方法以及@synthesize修饰符,建议使用-> MJExtension,保型模型清爽干净。

####功能说明:

-0.1

  • 通过JSON字符串生成对应属性
  • 通过文件写入的方式生成到.m文件
  • 支持输入嵌套模型名称

-0.2

  • 支持Swift
  • 修复JSON的value的值为Null的时候多出来的空行
  • 修复BOOL类型值格式化失效问题

-0.3

  • 支持生成MJExtension框架中objectClassInArray方法
  • 修复数组嵌套多级,里面子数组不能格式化的Bug

-0.4

  • 支持格式输出到文件
  • 支持格式输出泛型(Xcode 7及之后)

####Alcatraz

  • 支持 Alcatraz ,请搜索 ESJsonFormat

Screenshot

####效果: 简单模型

Screenshot

复杂模型

Screenshot

图中的JSON格式

{
    "name": "王五",
    "gender": "man",
    "age": 15,
    "height": "140cm",
}
{
    "name": "王五",
    "gender": "man",
    "age": 15,
    "height": "140cm",
    "addr": {
        "province": "fujian",
        "city": "quanzhou",
        "code": "300000"
    },
    "hobby": [
        {
            "name": "billiards",
            "code": "1"
        },
        {
            "name": "computerGame",
            "code": "2"
        }
    ]
}

####其他:

  • 如在使用过程中需要到问题,请你Issues我。
  • 有什么好的想法也可以Issues我。
  • 如果你半夜睡不着觉也可以Issues我。

Thanks:GsonFormatVVDocumenter-XcodeMJExtension

esjsonformat-xcode's People

Contributors

enjoysr avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.