Re: JSON Encoding and Decoding

2018-02-28 Thread Aditya Xavier
Hi Mynewt Team, I have been trying to decode JSON using the provided json decoding library. This particular library seems quite similar to mJSON, however there are difference regarding json_read_object etc. Also unlike mJSON, there is a requirement to write few more methods :- char

Re: JSON Encoding and Decoding

2018-02-28 Thread Aditya Xavier
I have been trying to use the same example as is; assuming that apache was also utilizing mJSON. However, it seems there are quite some differences from that library. For e.g. .addr.integer = PRN is no longer valid. It is now .arr.integers.store = PRN And json_read_object requires a struct

Re: JSON Encoding and Decoding

2018-02-28 Thread Christopher Collins
Hi Aditya, On Wed, Feb 28, 2018 at 06:35:04PM +0530, Aditya Xavier wrote: > Thanks got Encoding working for the required JSON. > > Any pointers on how to get the decoding working ? > > From the example >

Re: JSON Encoding and Decoding

2018-02-28 Thread Aditya Xavier
Thanks got Encoding working for the required JSON. Any pointers on how to get the decoding working ? From the example https://github.com/apache/mynewt-core/blob/master/encoding/json/test/src/testcases/json_simple_decode.c

Re: JSON Encoding and Decoding

2018-02-28 Thread marko kiiskila
> On Feb 28, 2018, at 10:10 AM, Aditya Xavier wrote: > > Yes, that was derp from my end. > > Any clue on how to encode the JSON structure I mentioned ? > > Is this method correct ? You need to initialize the encoder; it needs to be told where to write the encoded data.

Re: JSON Encoding and Decoding

2018-02-28 Thread Aditya Xavier
Yes, that was derp from my end. Any clue on how to encode the JSON structure I mentioned ? Is this method correct ? struct json_encoder *encoder, *module; struct json_value data; memset(, 0, sizeof(encoder)); memset(, 0, sizeof(module));

Re: JSON Encoding and Decoding

2018-02-27 Thread marko kiiskila
Hi Aditya, > On Feb 28, 2018, at 9:26 AM, Aditya Xavier wrote: > > HI Mynewt Team, > > Wanted some assistance on how to encode and decode the following JSON > string. > > {“name1":1,”name2”:"value2”,"name3":[{“name4":1,”name5":5}]} > > Because of