문제

Is there any way to change a single value in an already existing JSON file with JSONcpp? I want to preserve the existing formatting (comments, spaces, line breaks) in the file.

Example: find the value with key "test_boolean" in C:/test.json and make its value "false", leaving everything else as it is.

I've tried using Json::StyledStreamWriter, both with the root of the value I want to change, and the value itself. In the first case, the entire file was rewritten, with the new value, but no formatting or comments were preserved. In the second case, only "false" was written in the entire file.

도움이 되었습니까?

해결책

According to my tests/research, it is impossible to modify a single value in a JSON maintaining the current formatting, using JSONcpp.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top