forkachild / C-Simple-JSON-Parser

Extremely lightweight, easy-to-use & blazing fast JSON parsing library written in pure C
https://forkachild.github.io/C-Simple-JSON-Parser/
MIT License
47 stars 17 forks source link

Failed in PARSING JSON from File #18

Closed singhgurpreetcs closed 1 year ago

singhgurpreetcs commented 1 year ago

Hello,

The library is failing to parse the JSON if the input is

{ "I000":"0100", "I002":"1234567890123456", "I003":"000000", "I004":"000000001000", "I014":"1234", "I018":"6011", "I022":"0100", "I025":"000", "I037":"123456789012", "I049":"356" }

forkachild commented 1 year ago

@singhgurpreetcs Notice the whitespace/linebreak. According to the documentation to accomodate whitespace, you need to do either of the following:

  1. #define JSON_SKIP_WHITESPACE before #include "json.h", or
  2. Compile with -DJSON_SKIP_WHITESPACE

Note: This will incur a small overhead to remove the whitespaces

forkachild commented 1 year ago

Marking it closed since this is a miss of reading documentation