Code Monkey home page Code Monkey logo

json2swift's Introduction

json2swift

auto convert json string to swift struct.中文介绍

demo


  • How to use?

    OS X app

      1. Input json to left
      1. click "convert=>"
      1. Copy the result Parameters statement:
      • ObjectMapper: Simple JSON Object mapping written in Swift. If this is selected, result will auto add func mapping

      • name: the name of the result, default is "Result"

      • prefix: the prefix of each struct name, default is empty.

    python script

      1. open Terminal, cd to Main.py
      1. Copy json string to File named "jsons.txt"
      1. Python3 Main.py
      1. ResultModel.swift is the result


Other

CocoaPython: a fast way to use python with Cocoa. we can use CocoaPython.swift like this:

// python path
guard let aPath = Bundle.main.path(forResource: "Parse", ofType: "py") else { return }

// args: python accept paras
// block: complete block
let script = CocoaPython(scrPath: aPath, args: [""]) { [weak self] in
    print($0) // python's return
    print($1) // python's Error
}

script.spliPara = "$" // the multi results's split Character, if not set, all the results is in result[0]. 
script.runAsync()
// or script.runAsync(asyncComlete: false) // the complete block call in global async
// or script.runSync() // run in current thread

Reference

json2swift's People

Contributors

ashen-23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

json2swift's Issues

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.