Esteban, I had a quick look at the spec you mentioned.
I am a bit puzzled though. Result can be anything, so how are you going to map that to specific classes (and why) ? That would require serious prior knowledge and even then, not every situation can be mapped easily to a class. You speak about subclassing NeoJSONObject, which is cool, because it is so flexible, but then why type it further ? If I were you, I would at least start the easy/lazy way. For example you could do NeoJSONObject fromString: '...' And see how far you get. If things get slow, I would look for alternatives. Sven > On 26 Jul 2017, at 02:38, Esteban A. Maringolo <emaring...@gmail.com> wrote: > > Hi Sven, all, > > I'm working on a JSON-RPC client, I started using LtJsonRpcClient, but > since it's based on the "legacy" JSON package I decided to try to > adapt it to use NeoJSON. So I created a NeoJSONRPCClient based on > LtJson... because... why not. > > At its core JSON-RPC is a pretty simple protocol, every response is a > JSON object with a 'result' attribute holding the returned object from > the RPC call, an 'error' one (nil if no error happened), and a few > other ones [1]. > > If I convert the response using the traditional `NeoJSONReader > fromString: responseObject` all the object three is converted to a > Dictionary, and what I want is to be able to: > > 1. Determine whether there was an error in the response > 2. If there was no error, convert the 'result' field to my preferred > class of object instead of a Dictionary. I plan to make my classes > inherit from NeoJSONObject though. > > All the above to avoid the use of an intermediate set of nested > dictionaries (which could be in the thousands). > I understand I could subclass NeoJSONReader to perform that at the > character stream level, but I wanted to ask first whether there is a > pattern/configuration of dealing with something like this. > > Best regards! > > [1] http://www.jsonrpc.org/specification#response_object > > Esteban A. Maringolo >