我正在寻找支持或库,允许我将JSON对象序列化为char数组,并将char数组/字符串解析为JSON对象。我查看了JSMN库,但它看起来只是解析,而不是序列化。我目前在ARDUINO板上使用ARDuijJon来执行这些任务,我想将代码迁移到PIC32。我正在寻找尽可能接近的功能,以便于迁移。我是:1。使用ARDIONJSON 2创建内存中的JSON对象。将所有需要传输的数据复制到新创建的JSON对象。3。调用ARDUIONJSON函数将新创建的JSON对象序列化为char数组。4。通过UART 5发送字符阵列。销毁JSON对象(超出范围),并在接收序列化字符串时:1。在内存中创建一个JSON对象并使用ARDuijJSON解析函数填充它。2。将所有相关数据从新创建的JSON对象复制到我自己的数据结构。3。销毁JSON对象(走出范围)。就像我说的,我正在寻找一个类似于这个功能的库,再加上UART/串行
通信。我会感激任何建议,就是这样的东西存在。提前感谢。
以上来自于百度翻译
以下为原文
I am looking for support or libraries to allow me to serialize a JSON object into a char array and to parse a char array/string into a JSON object. I looked into the
jsmn library but it looks like it only does parsing, not serializing.
I am currently using
ArduinoJson on an Arduino board to perform those tasks and I would like to migrate the code to a
PIC32. I am looking for as close a func
tionality as possible for ease of migration.
I am:
1. Creating a JSON object in memory, using
ArduinoJson.
2. Copying all the data I need to transmit into the newly created JSON object.
3. Calling an
ArduinoJson function to serialize the newly created JSON object into a char array.
4. Transmitting the char array through UART.
5. Destroying the JSON object (going out of scope).
And when receiving a serialized string:
1. Create a JSON object in memory and populate it using
ArduinoJson parse function.
2. Copy all relevant data from the newly created JSON object to my own data structures.
3. Destroy the JSON object (going out of scope).
Like I said, I am looking for a library that will closely resemble this functionality, coupled with UART/Serial communication. I will appreciate any suggestions, is such a thing exists. Thanks in advance.