We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello. I try to replace exising json object with another, but fail. I use json_object_set_value. Return 0, but JSON invalid. Code:
JSON_Value *root_value = json_parse_string(pcBuffer); if (!root_value) return 1; JSON_Object *root_object = json_value_get_object(root_value); if (!root_object) return 1; JSON_Object *protection = json_object_get_object(root_object, "protection"); if (!protection) return 1; status = json_object_set_value(protection, "macs", json_parse_string(pchAddedJSON)); if (status != 0) return 1; char* result = json_serialize_to_string(root_value);
pchAddedJSON file content: http://pastebin.com/W2YnuXsj
Exiting JSON file content (before any operations, valid): http://pastebin.com/X5tjG9hd
After insert JSON file content (invalid file): http://pastebin.com/90P251D4
The text was updated successfully, but these errors were encountered:
I wasn't able to reproduce this issue. That's the code I used:
#include <assert.h> #include "parson.h" int main() { JSON_Value *file1_value = json_parse_file("1.json"); /* http://pastebin.com/X5tjG9hd */ assert(file1_value != NULL); JSON_Object *root_object = json_value_get_object(file1_value); assert(root_object != NULL); JSON_Object *protection = json_object_get_object(root_object, "protection"); assert(protection != NULL); JSON_Value *file2_value = json_parse_file("2.json"); /* http://pastebin.com/W2YnuXsj */ assert(file2_value != NULL); JSON_Status status = json_object_set_value(protection, "macs", file2_value); assert(status == JSONSuccess); char* result = json_serialize_to_string(file1_value); assert(result != NULL); puts(result); }
Could you include full example that shows this issue?
Sorry, something went wrong.
Yeah, it is my error. I have write function and found error in my code. Sorry for false Issue. Closed.
No branches or pull requests
Hello.
I try to replace exising json object with another, but fail.
I use json_object_set_value. Return 0, but JSON invalid.
Code:
pchAddedJSON file content:
http://pastebin.com/W2YnuXsj
Exiting JSON file content (before any operations, valid):
http://pastebin.com/X5tjG9hd
After insert JSON file content (invalid file):
http://pastebin.com/90P251D4
The text was updated successfully, but these errors were encountered: