rapidjson icon indicating copy to clipboard operation
rapidjson copied to clipboard

Request: coercing capitalized bool (e.g. True to true)

Open jamesbraza opened this issue 2 years ago • 1 comments

I am working with an LLM that responds in JSON. Unfortunately, sometimes it responds with capitalized bool variables (True/False), which aren't valid JSON.

I use RapidJSON to help me coerce JSON using ParseFlags like kParseTrailingCommasFlag.

Do you think we can add a parse flag, sometime like kParseCapsInsensitiveBool to coerce True/False?

jamesbraza avatar Nov 17 '23 21:11 jamesbraza

It's possible to implement custom reader (points of interest are ParseValue, ParseTrue and ParseFalse) in C++ to implement this, but it seems you're using python. The most simple thing you can do is to fork rapidjson and add an implementation of this feature and compile your module with it. Submitting a pull request wouldn't be unreasonable, the feature sounds good to me.

aikawayataro avatar Nov 18 '23 07:11 aikawayataro