GithubHelp home page GithubHelp logo

taquitos / jlobjectmapping Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 3.0 53 KB

Simple JSON to object and object to JSON mapping inspired by Jackson JSON Processor for Java.

License: MIT License

Objective-C 100.00%

jlobjectmapping's People

Contributors

taquitos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jlobjectmapping's Issues

determine what should happen when multiple JSON properties map to the same objc property (many to one)

This happens when you have an override in the propertyNameMap (to remap a JSON property name to an objc property name) and the JSON also includes the same name of the property:

{
"name":"josh",
"username":"turtles",
}

objc-
@Property username;

  • (NSDictionary *)propertyNameMap{
    return @{@"username" : @"name"}
    }

this shows that we should map JSON property "name" (josh) to the objc property "username". Since "username" (turtles) exists in the JSON as well, we can't guarantee which one will win out. We should probably spit out an error or something.

Exceptions aren't safe in ARC

Wrap the NSJSONSerialization class in a non-arc compiled class and use that instead of directly catching it in JLObjectDeserializer -_objectWithString:targetClass:

Add mapping for enumeration and option values

Right now enums and options are transcoded as whatever primitive values they are backed by. It would be nice to be able to provide strings that map to those values:
typedef NS_ENUM(NSInteger, MyEnum) {
MyEnumAValue = 1,
MyEnumSecondValue,
MyEnumThirdValue
};
so MyEnumSecondValue could map to "SecondValue" in the JSON instead of "2" (and so on)

Mark fields as required

maybe mark fields automatically as required, meaning you have to mark fields as not required if they are optional. On error, return nil and maybe out param nserror?

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.