-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
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
convert between msgpack and json via cJSON library #870
Conversation
Codecov Report
@@ Coverage Diff @@
## master #870 +/- ##
=======================================
Coverage 81.16% 81.16%
=======================================
Files 86 86
Lines 6419 6419
=======================================
Hits 5210 5210
Misses 1209 1209 |
It seems that you added not only json example for C but also some convenient functions. |
I think that |
I have another idea:
bin, ext are the same as str. |
If I design the API from the scratch, the following functions are better as you mentioned. msgpack_pack_str() => msgpack_pack_str_head()/msgpack_pack_str_header()
msgpack_pack_str_body() => msgpack_pack_str_body()
msgpack_pack_str_intact() => msgpack_pack_str() However, I want to avoid breaking change because it require code updating to many users. |
Indeed, Now I'll use |
Codecov Report
@@ Coverage Diff @@
## master #870 +/- ##
=======================================
Coverage 81.16% 81.16%
=======================================
Files 86 86
Lines 6419 6419
=======================================
Hits 5210 5210
Misses 1209 1209 |
Thank you for understanding and updating the code. |
Pack json string to msgpack format data.
int msgpack_pack_jsonstr(msgpack_packer *pk, const char *jsonstr)
Convert msgpack format data to json string.
int msgpack_object_print_jsonstr(char *buffer, size_t length, const msgpack_object o)