2

I use the org.json.* classes which are part of the j2objc distribution. The mapping of my DTO classes and the JSON Objects are made by hand so far. I know there is GSOn and Jackson.

Is there a JSON to Object Mapper library which translates well with J2objc and works well in the translated Objective-C code?

2
  • 1
    Do you want to map json object to java object ? Commented Apr 29, 2015 at 12:19
  • 1
    @Paritosh yes json to java and java to json Commented Apr 29, 2015 at 12:43

2 Answers 2

2

Jackson and GSON are the two best libraries, and both have been translated using j2objc for iOS apps from different teams (no public ports that I'm aware of, though).

If you control the server-side of the app, though, protocol buffers are generally faster than any JSON->Java alternative. That is why they're used by most of Google's iOS apps, including Inbox and Sheets that use j2objc. j2objc now publicly supports protocol buffers.

Sign up to request clarification or add additional context in comments.

Comments

0

To convert json data to java object you can use:

  1. Jackson
  2. Gson

Follow this link or this link for nice GSON tutorial.

I personally used GSON, and it is best library for json to java object conversion.

I don't know about conversion part of j2objc but you can follow this answer, if you want to do similar thing with iOS code

Edit

According to this answer, j2objc requires source code for conversion. You will get full source code from here.

Now, the important part, Gson can be converted to j2objc and you can find test repository to test support for gson-2.3 with j2objc here.

2 Comments

Not related to my question!
Check Edit part

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.