2

I have checked the documentation: https://github.com/DaveGamble/cJSON#parsing-json and https://github.com/DaveGamble/cJSON#printing-json.

My question is I have a function void foo (char *JSON); that can only accept size_t JSON string representation at a time. The JSON String is larger than size_t. Either I can parse the full JSON and print it in size_t chunks or I would have to split the JSON string into size_t and sanitize it to retain it in well-formed JSON format.

Is there a CJSON API that could help me in any of the scenarios?

NewUser
  • 41
  • 5
  • *The JSON String is larger than size_t.*? What OS/hardware are you running on? You're not getting 4+ GB of JSON on a 32-bit system, are you?!?! That'd be one horrid, unthinking design decision: "Let's feed multiple GB of JSON to 32-bit processors!!!" The stupid is strong there. There might be a streaming JSON parser that fits your needs, but product recommendations are off-topic here. – Andrew Henle Dec 09 '22 at 00:40
  • There are definitely better options then cjson if working with such huge json texts. – Shawn Dec 09 '22 at 01:05
  • Thanks for looking into the question. The size_t is not very large. The external embedded device code ```function foo``` has some basic size restrictions. We are already using CJSON for the c code. Please recommend some solution. – NewUser Dec 09 '22 at 02:33

0 Answers0