You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I somehow missed it in the docs/implementation or I am unable to find it.
We currently get json input as string, parse it via rapidjson::GenericDocument::ParseInsitu, and iterate over the elements. In the case of an error (or other reasons) we would like to map a rapidjson::Value to the char offset/line in the original json string/file. Is there a way to do this for rapidjson::Value's? If not, is there some other Parsing Model in rapidjson which would support this feature in some kind of way?
The text was updated successfully, but these errors were encountered:
You can create the GenericInsituStringStream yourself and pass to GenericDocument::ParseStream, and then using GenericInsituStringStream::Tell() to get the position when fail. However, the position is not represented in line/column. You may code a new stream class that counts line/column.
Ah sorry, I accidentally remove too much detail before posting it. But thank you already for the quick answers!
The parsing operation passes, and everything is fine from a json formatting/parsing perspective.
But AFTER the parsing is done and passes, we look through the values and see some value greater X (which we want to alert someone that this is an error).
Is there a way to get the offset of the actual rapidjson::Value object to the initial string/file?
Currently no. You may consider using JSON schema in RapidJSON to validate the document and it will provide a JSON path for addressing the problem (although not in terms of line/column).
I somehow missed it in the docs/implementation or I am unable to find it.
We currently get json input as string, parse it via rapidjson::GenericDocument::ParseInsitu, and iterate over the elements. In the case of an error (or other reasons) we would like to map a rapidjson::Value to the char offset/line in the original json string/file. Is there a way to do this for rapidjson::Value's? If not, is there some other Parsing Model in rapidjson which would support this feature in some kind of way?
The text was updated successfully, but these errors were encountered: