0

I needs JSON 'C' based opensource to do very minimal job of json .. since I need to put this on some embedded devcie . I am looking for simple functionality with size less than 15kB(json parser and composer)..

is there any JSON opesource with less size..?

indra
  • 832
  • 4
  • 17
  • 33

2 Answers2

1

Js0n is the lightest library there is, but it is mostly inspirational, rather than meant for serious use:

https://github.com/quartzjer/js0n

user1095108
  • 14,119
  • 9
  • 58
  • 116
  • Hi, is this support json composer also ? and I could not do the bnject parsing with this .. "first": "John", "sex": "Male", "age": "38", "children": [ {"name": "Sally"}, {"name": "Jimmy"}, ] I could not do the children key values – indra Apr 29 '14 at 08:13
  • I don't know what the problem is, but there is also a utility library called `j0g.h`, look there, if you have problems using `js0n`. – user1095108 Apr 29 '14 at 08:22
  • I went through it does not have API for reading string object(in my above example Children is a string object. I need to know, how to process the string object using this – indra Apr 29 '14 at 08:50
  • As I wrote, it is mostly inspirational and it does not support composing as you requested anyway. You need to add the missing functionality or use another library. Many lightweight json parsers were inspired by this. – user1095108 Apr 29 '14 at 08:53
0

Try cJSON ! Quite easy to use

https://github.com/DaveGamble/cJSON

FSMaxB
  • 2,280
  • 3
  • 22
  • 41
persia
  • 16
  • 2
  • Hi, I found this is very useful to use. this is my json { "name": "Jack", "bar":[1,2,3], "format": { "type": "rect", "width": 1920, } } .. and parsing the getting the object worked with this method cJSON *format = cJSON_GetObjectItem(json,"format"); int framerate = cJSON_GetObjectItem(format,"frame rate")->valueint; but I am not able to parse array and simple key value , I tried this cJSON *array = cJSON_GetArrayItem(json,"bar"); int value = cJSON_GetArrayItem(format1,1)->valueint; but did nt work, how to parse the array – indra Apr 29 '14 at 10:08
  • There is a readme file in the folder ...you can use the following code to parse array item void parse_object(cJSON *item) { int i; for (i=0;i – persia Apr 30 '14 at 02:52