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

Reply via email to