Json: How to encode an array of objects #52431
-
I need to encode an array of objects like this: but when i use this macro: JSON_OBJ_DESCR_OBJ_ARRAY Produce something like this:
¿How can i encode this array without the additional object: "simple_s"?. My json description structure code is like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
My bad, i used this function:
But the second (
|
Beta Was this translation helpful? Give feedback.
My bad, i used this function:
json_obj_encode_buf
instead ofjson_arr_encode_buf
. The first is for encode objects, so generate this output:{"simple _s":[{"number":5 ,"text":"aaaaaa" ,"no_used":0},{" number":8,"text" :"eeeee","no_use d":0},{"number": 7,"text":"iiiiii ","no_used":0}]}
But the second (
json_arr_encode_buf
) generates an array, so the encoded output is like this:[{"number":5 ,"text":"aaaaaa" ,"no_used":0},{" number":8,"text" :"eeeee","no_use d":0},{"number": 7,"text":"iiiiii ","no_used":0}]