Reputation: 33307
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?
Upvotes: 2
Views: 755
Reputation: 2044
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.
Upvotes: 2
Reputation: 2147
To convert json
data to java
object you can use:
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.
Upvotes: 0