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,
below the code I'm running
strcpy( s_in, "{"Hello":1,"b":2}" ); printf( "Initial : %s\n", s_in ); // {"Hello":1,"b":2} => OK
struct json_out out = JSON_OUT_BUF( s_out, sizeof( s_out ) ); json_setf( s_in, sizeof( s_in ), &out, ".Hello", "7" ); strcpy( s_in, s_out ); printf( "Step 1 : %s\n", s_in ); // {"Hello":7,"b":2} => OK
out.u.buf.len = 0; json_setf( s_in, sizeof( s_in ), &out, ".b", "8" ); strcpy( s_in, s_out ); printf( "Step 2 : %s\n", s_in ); // {"Hello":7,"b":8} => OK
out.u.buf.len = 0; json_setf( s_in, sizeof( s_in ), &out, ".Goodbye", "10" ); // {"Hello":7,"b":8,"G":10} => G instead of Goodbye strcpy( s_in, s_out ); printf( "Step 3 : %s\n", s_in );
On the latest block, trying to add Goodby key, and got G.
The text was updated successfully, but these errors were encountered:
PR please :)
Sorry, something went wrong.
Another example:
char *response; response = "{ \"result\": null }"; printf( "initial response: [%s]\n", response); char tempResponse[65535]; struct json_out jsonToOutputBuffer = JSON_OUT_BUF(tempResponse, sizeof(tempResponse)); jsonToOutputBuffer.u.buf.len = 0; json_setf(response, strlen(response), &jsonToOutputBuffer, ".result", "OK"); response = tempResponse; printf( "step 1 response: [%s]\n", response); jsonToOutputBuffer.u.buf.len = 0; json_setf(response, strlen(response), &jsonToOutputBuffer, ".foo", "bar"); response = tempResponse; printf( "step 2 response: [%s]\n", response); jsonToOutputBuffer.u.buf.len = 0; json_setf(response, strlen(response), &jsonToOutputBuffer, ".sed", "rag"); response = tempResponse; printf( "step 3 response: [%s]\n", response);
Produces result of:
initial response: [{ "result": null }] step 1 response: [{ "result": "OK" }] step 2 response: [{ "result": "OK,"foo":"bar","f] step 3 response: [,"sed":"rag"]
Expected result was:
initial response: [{ "result": null }] step 1 response: [{ "result": "OK" }] step 2 response: [{ "result": "OK,"foo":"bar" }] step 3 response: [{ "result": "OK,"foo":"bar","sed":"rag" }]
There is clearly an issue in code, that makes this library unusable.
No branches or pull requests
Hello,
below the code I'm running
strcpy( s_in, "{"Hello":1,"b":2}" );
printf( "Initial : %s\n", s_in ); // {"Hello":1,"b":2} => OK
struct json_out out = JSON_OUT_BUF( s_out, sizeof( s_out ) );
json_setf( s_in, sizeof( s_in ), &out, ".Hello", "7" );
strcpy( s_in, s_out );
printf( "Step 1 : %s\n", s_in ); // {"Hello":7,"b":2} => OK
out.u.buf.len = 0;
json_setf( s_in, sizeof( s_in ), &out, ".b", "8" );
strcpy( s_in, s_out );
printf( "Step 2 : %s\n", s_in ); // {"Hello":7,"b":8} => OK
out.u.buf.len = 0;
json_setf( s_in, sizeof( s_in ), &out, ".Goodbye", "10" ); // {"Hello":7,"b":8,"G":10} => G instead of Goodbye
strcpy( s_in, s_out );
printf( "Step 3 : %s\n", s_in );
On the latest block, trying to add Goodby key, and got G.
The text was updated successfully, but these errors were encountered: