Why is my array of strings encoded as a single string with "jsonencode"?
Mostra commenti meno recenti
I created a struct with data:
>> data.key_a = "value_a";
>> data.key_b = ["value_b"];
Then, I encoded the struct in JSON format:
>> json = jsonencode(data);
The resulting JSON looks like this:
{"key_a":"value_a","key_b":"value_b"}
I would expect the attribute "key_b" to have a value ["value_b"] as I specified the field "key_b" to have an array of strings as its value in the "data" struct above. Why is this not the case?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su JSON Format in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!