I used JSON-C for a work project and would recommend it. ... We used it in this way, compiling JSON-C as a static library that is linked in with the main build.
Json isn't a huge language to start with, so libraries for it are likely to be small(er than Xml libraries, at least).There are a whole ton of C libraries linked at Json.org. Maybe one of them will work well for you.
26 Ocak 2021
89 kişi değerlendirdi
6 yorum
{"2_d74p":{"state":{"logo":{"href":"//yandex.com.tr","isForeign":true},"form":{"action":"/search","searchLabel":"Bul","hiddenInputs":[{"name":"lr","value":20815}]},"actions":{"advancedSearch":{"checked":false,"ariaLabel":"Gelişmiş arama"},"moreButtonProps":{"ariaLabel":"Daha fazla"},"cbir":{"name":"cbir","label":"Поиск по картинке","infoUrl":"//yandex.ru/promo/photosearch/index?source=landingdesk","isMacOS":false}},"userSection":{"loggedIn":false,"loginProps":{"loginUrl":"https://passport.yandex.com.tr/auth?retpath=%2F&origin=serp_desktop_auth_new","loginText":"Giriş yap","burgerAriaLabel":"Menü"}},"navigation":{"tabs":[{"id":"www","label":"Arama","url":"//yandex.com.tr","params":{"source":"tabbar"},"target":""},{"id":"images","label":"Görsel","url":"//yandex.com.tr/gorsel/search","params":{"text":"[$query]","noreask":"[$noreask]","nomisspell":"[$nomisspell]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"video","label":"Video","url":"//yandex.com.tr/video/search","params":{"text":"[$query]","noreask":"[$noreask]","parent-reqid":"[$reqid]","from":"tabbar"}},{"id":"maps","label":"Haritalar","url":"//yandex.com.tr/harita","params":{"text":"[$query]","source":"serp_navig"}},{"id":"translate","label":"Çeviri","url":"//ceviri.yandex.com.tr","params":{"text":"[$query]","from":"tabbar"}}],"selectedTabId":"www"},"context":{"query":"json c","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","noreask":"1","lr":"20815","counters":{"type":"b","data":{"$header":"0_131dz000","logo":"0_131dz001","login":"0_131dz003","usermenu":"0_131dz004","market-cart":"0_131dz006","more-button":"0_131dz007","cbir":"0_131dz008","$navigation":"0_131dz009","item":"0_131dz00i","tab-www":"0_131dz00b","tab-images":"0_131dz00d","tab-video":"0_131dz00f","tab-maps":"0_131dz00h","tab-translate":"0_131dz00j"}}},"loggedIn":false,"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"0_131dw01-0-1"},"ui":"desktop","service":"web","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","fast":{"name":"header-desktop"}}}}},"type":"header-desktop"},"2_131d0":{"state":{"thumbWidth":198,"thumbHeight":113,"videoPreviewHref":"http://www.youtube.com/watch?v=dQyXuFWylm4","internalLinksTarget":"_blank","posterSrc":"//avatars.mds.yandex.net/get-vthumb/3660006/d5f79b41cee65b82f24432f9e12285ef/564x318","videoSrc":"https://video-preview.s3.yandex.net/6cM9ewAAAAA.mp4","videoType":"video/mp4","duration":"7:08","isAdultContent":false,"isVertical":false,"logNode":{"name":"video","attrs":{"externalId":{"entity":"video","id":"3832098859538825538"},"hasVideoViewerLink":false,"hasFilmId":true}},"organicVideoMeta":{"created":"30 Ara 2018","views":"68 bin görüntüleme"},"i18nTexts":{"durationAriaLabel":"Süre","freshAriaLabel":"Yayınlandı"},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_131dw04-0-1"},"ui":"desktop","service":"web","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","organic":1}}}},"type":"organic"},"2_131d1":{"state":{"answersUrl":"https://stackoverflow.com/questions/6673936/parsing-json-using-c#answers","type":"fact","tabsOptions":[{"id":"question","text":"Soru"},{"id":"bestAnswer","text":"En iyi yanıt"},{"id":"moreAnswers","text":"6 yanıt daha","shortText":"Daha fazla"}],"tabContents":{"question":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"I'm trying to find a good way to parse JSON in C. I really don't need a huge library or anything, I would rather have something small and lightweight with a bare minimum of features, but good documentation. "}]},{"type":"paragraph","content":[{"type":"text","content":"Does anyone have anything they can point me to?"}]}],"footerProps":{"date":1429523227,"numLiked":106,"numCommented":7}},"bestAnswer":{"construct":[{"type":"paragraph","content":[{"type":"text","content":"Json isn't a huge language to start with, so libraries for it are likely to be small(er than Xml libraries, at least)."}]},{"type":"paragraph","content":[{"type":"text","content":"There are a whole ton of "},{"type":"text","content":"C libraries linked at Json.org"},{"type":"text","content":". Maybe one of them will work well for you."}]}],"footerProps":{"date":1611658273,"numLiked":89,"numCommented":6}},"moreAnswers":[{"construct":[{"type":"paragraph","content":[{"type":"text","content":"cJSON"},{"type":"text","content":" has a decent API and is small (2 files, ~700 lines). Many of the other JSON parsers I looked at first were huge... I just want to parse some JSON."}]},{"type":"paragraph","content":[{"type":"text","content":"Edit: We've made "},{"type":"text","content":"some improvements"},{"type":"text","content":" to cJSON over the years."}]}],"footerProps":{"date":1504113954,"numLiked":45,"numCommented":2}},{"construct":[{"type":"paragraph","content":[{"type":"text","content":"NXJSON"},{"type":"text","content":" is full-featured yet very small (~400 lines of code) JSON parser, which has easy to use API:"}]},{"type":"code","content":[{"type":"text","content":[{"type":"text","color":"keyword","content":"const"},{"type":"text","content":" nx_json* json=nx_json_parse_utf8(code);"}]},{"type":"text","content":[{"type":"text","content":"printf("},{"type":"text","color":"string","content":"\"hello=%s\\n\""},{"type":"text","content":", nx_json_get(json, "},{"type":"text","color":"string","content":"\"hello\""},{"type":"text","content":")->text_value);"}]},{"type":"text","content":[{"type":"text","color":"keyword","content":"const"},{"type":"text","content":" nx_json* arr=nx_json_get(json, "},{"type":"text","color":"string","content":"\"my-array\""},{"type":"text","content":");"}]},{"type":"text","content":[{"type":"text","color":"name","content":"int"},{"type":"text","content":" i;"}]},{"type":"text","content":[{"type":"text","color":"keyword","content":"for"},{"type":"text","content":" (i="},{"type":"text","color":"name","content":"0"},{"type":"text","content":"; i\u003carr->length; i++) {"}]},{"type":"text","content":[{"type":"text","content":" "},{"type":"text","color":"keyword","content":"const"},{"type":"text","content":" nx_json* item=nx_json_item(arr, i);"}]},{"type":"text","content":[{"type":"text","content":" printf("},{"type":"text","color":"string","content":"\"arr[%d]=(%d) %ld\\n\""},{"type":"text","content":", i, ("},{"type":"text","color":"name","content":"int"},{"type":"text","content":")item->type, item->int_value);"}]},{"type":"text","content":[{"type":"text","content":"}"}]},{"type":"text","content":[{"type":"text","content":"nx_json_free(json);"}]}]}],"footerProps":{"date":1612659969,"numLiked":13,"numCommented":2}}]},"organic":{"faviconProps":{"src":"https://favicon.yandex.net/favicon/v2/https://stackoverflow.com","size":"m","pageNumber":0,"index":0},"title":"Parsing \u0007[JSON\u0007] using \u0007[C\u0007] [closed]","pathProps":{"items":[{"url":"https://stackoverflow.com/questions/6673936/parsing-json-using-c","text":"stackoverflow.com"},{"url":"https://stackoverflow.com/questions/6673936/parsing-json-using-c","text":"parsing-json-using-c"}]},"faviconPosition":0,"subtitlePosition":1,"linkProps":{"url":"https://stackoverflow.com/questions/6673936/parsing-json-using-c"},"hostTitle":"stackoverflow.com","description":""},"extralinksProps":{"hidden":true,"directions":["bottom-end"],"items":[{"variant":"reportFeedback","reportFeedback":{"feature":"Блок ответов для разработчиков","title":"Bu yanıtta yanlış olan nedir?","checkBoxLabels":[{"value":"Yanıt sorguya uygun değil"},{"value":"Yanıt hatalı"},{"value":"Yanıttaki bilgiler eksik"},{"value":"Diğer"}]}}]},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_131dw0c-0-1"},"ui":"desktop","service":"web","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","fast":{"name":"article"}}}}},"type":"article"},"2_131d2":{"state":{"linksGroups":[{"type":"geo","links":[{"label":"Columbus","title":"Columbus","url":"//yandex.com.tr/tune/geo","logNode":{"name":"region"},"target":"_self","a11yLabel":"Bölgeniz Columbus","needRetpath":true}]},{"type":"feedback","links":[{"label":"Hata bildir","logNode":{"name":"feedback","attrs":{"behaviour":{"type":"dynamic"}}}}]},{"type":"settings","links":[{"label":"Ayarlar","url":"//yandex.com.tr/tune/search","logNode":{"name":"settings"},"target":"_self","needRetpath":true}]},{"type":"company","links":[{"label":"Hakkımızda","url":"https://company.yandex.com.tr","logNode":{"name":"about"},"target":"_blank"},{"label":"Ticari teklifler","url":"/search/direct?text=json%20c&filters_docs=direct_cm","logNode":{"name":"commercial"},"target":"_blank"},{"label":"Kariyer","url":"//yandex.com.tr/jobs/?utm_source=serp_turkie&utm_medium=footerlink&utm_content=career","logNode":{"name":"vacancy"},"target":"_blank"},{"label":"Kullanım lisansı","url":"//yandex.com.tr/legal/termsofuse/","logNode":{"name":"license"},"target":"_blank"},{"label":"Gizlilik Politikası","url":"//yandex.com.tr/legal/confidential/","logNode":{"name":"confidential"},"target":"_blank"}],"a11yHidden":true}],"reportFeedbackProps":{"feature":"Подвал","title":"Hata bildir","checkBoxLabels":[]},"isSearchApp":false,"hasExtralinks":true,"limitingSelector":".AliceFabButton","baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_131dw0d-0-1"},"ui":"desktop","service":"web","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL"}}}},"type":"serp-footer"},"2_131d3":{"state":{"conditionLoadList":{"marketCart":false,"highchartsHighstock":false,"advProductGallery":false,"musicPlayer":false,"ecomRates":false,"photoViewer":false,"easterEggModal":false,"darkmodeChangeDrawer":true},"reportFeedbackBaseProps":{"initEmail":"","metaFields":{"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","userTestids":"186144,1062751,1067680,903869,1062604,1053380,1052824,1054087,1046811,1066378,1052591,1059417,1048639,1060224,744171,754535,614105,1064765,1063114,1062081,1067025,1066183,66290,1061176,1055872,1067479,1065118,1036351,1063619,710258,477964,1050771,1064472,1056357,1063714,1058366,90501,1062157,1066304,1065309,1053210,1056315,1061919,1059894,1065203,1064228,151171,126283,126345,1046868,1058163,13962,287509,338390,927534,1065998,1061658,1054352,1059577,1052892","yandexuid":"5959949131721298598","uid":"0","queryText":"json c","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","searchSlices":["drawer_search_slice_english","drawer_search_slice_cs"],"userRegionName":"Columbus","userRegionId":"20815"}},"extralinksPopupProps":{"abuseLink":"https://twitter.yandex.com.tr/search/abuse?sign=c451aa64c80f5fdeb1e92569a21c471d&keyno=0"},"isLoggedIn":false,"userMenuDialogProps":{"flag":"skin,feedback","host":"yandex.com.tr","lang":"tr","project":"serp","queryParams":{"utm_source":"search"},"retpath":"https%3A%2F%2Ftwitter.yandex.com.tr%2Fsearch%3Flr%3D20815%26noreask%3D1%26rnd%3D63359%26rq%3D1%26serp-reload-from%3Drec_bottom%26source%3Dtabbar%26text%3Djson%2Bc%26ncrnd%3D274","tld":"com.tr"},"baobab":{"parentNode":{"context":{"genInfo":{"prefix":"2_131dw0e-0-1"},"ui":"desktop","service":"web","reqid":"1721298598115258-3401969334795994913-balancer-l7leveler-kubr-yp-klg-233-BAL","fast":{"name":"lazy-load"}}}}},"type":"lazy-load"}}