Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your only option is probably, to get access on an OpenSource library and take a look at the code how the JSON Serializer is implemented. Then you could possibly extend the library for your purpose. By "extending" I mean, that you should utilize as much as possible from the existing library, since making your own serializer from scratch can be a lot of work.</p> <p>Usually, the JSON libraries define a mapping between the JSON types and the corresponding Objective-C types (classes). For instance, a JSON Array maps to a NSArray/NSMutableArray, a JSON Object maps to a NSDictionary/NSMutableDictionary, etc.</p> <p>The "JSON Serializer" would therefore "know" how to serialize a "mapped" Objective-C object into a JSON element. One way to implement this behavior is to add a Category to the mapped Objective-C class. </p> <p>So, when "extending the library" (depending on the library and the implementation), it may be sufficient to just add a Category for your custom classes and implement it accordingly.</p> <p>I'm an author of a JSON library. Creating Categories for custom classes which then can be used in the JSON Serializer wouldn't be that much effort. You might specify your needs in an Enhancement request, so I could possibly adjust the library to make it more easy to add Custom classes.</p> <p>Your Category would look like as follows:</p> <pre><code>@interface NSOrderedSet (JPJsonWriter) &lt;JPJsonWriterInserterProtocol&gt; @end @implementation NSOrderedSet (JPJsonWriter) - (int) JPJsonWriter_insertIntoBuffer:(NSMutableDataPushbackBuffer*)buffer encoding:(JPUnicodeEncoding)encoding options:(JPJsonWriterOptions)options level:(NSUInteger)level { return insertJsonArray(self, buffer, encoding, options, level); } @end </code></pre> <p>This is actually all what you have to do - after making a few adjustments to my library. But please note: this is dependent on the JSON library you are using. You can find my JSON library on <a href="https://github.com/couchdeveloper/JPJson" rel="nofollow">here</a>. Please file an enhancement request - thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload