GithubHelp home page GithubHelp logo

sam961 / collectionfactory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elliotchance/collectionfactory

0.0 1.0 0.0 444 KB

Translation between native collections in Objective-C and serialized formats like JSON.

License: MIT License

collectionfactory's Introduction

CollectionFactory

Translation between native collections in Objective-C and serialized formats like JSON.

Static methods always return nil if an error occurs (such as JSON could not be passed or was an invalid expected type)

You may see the method [- jsonString], this is an internal method you should not call directly. use the provided [- jsonValue] provided.

NSObject

  • + objectFromJson: - convert JSON string into an object.
  • - dictionaryValue - convert an objects properties into an NSDictionary.
  • - jsonValue - translate any object into JSON.

[- jsonValue]

The kind of class is tested in this order:

  • NSDictionary: A JSON object is returned based on the key/values of the dictionary.
  • NSArray: A JSON array is returned with the items in the array.
  • NSString: A safely double-quoted string is returned.
  • NSNumber: Raw number is returned.
  • If none of the above match then the object is converted using [- dictionaryValue] and then the JSON for that dictionary is returned.

[+ objectFromJson:]

This is the opposite of [- jsonValue], it will perform the same checks in reverse.

NSArray

  • + arrayWithJsonString: - create an NSArray from a JSON string.
  • + arrayWithJsonData: - create an NSArray from a JSON data.

NSDictionary

  • + dictionaryWithJsonData: - create an NSDictionary from a JSON data.
  • + dictionaryWithJsonString: - create an NSDictionary from a JSON string.

NSMutableDictionary

  • + mutableDictionaryWithJsonString: - create an NSMutableDictionary from a JSON string.
  • + mutableDictionaryWithJsonData: - create an NSMutableDictionary from a JSON data.
  • + mutableDictionaryWithJsonFile: - create an NSMutableDictionary from a file that contains JSON.

collectionfactory's People

Contributors

elliotchance avatar

Watchers

James Cloos 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.