JSON decoder/encoder eats arrays | General | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
JSON decoder/encoder eats arrays
No permission to create posts
October 10, 2018
11:44 pm
Avatar
heh

Gold
Members
Forum Posts: 29
Member Since:
June 30, 2017
sp_UserOfflineSmall Offline

Hello

On certain strings jsondecode / jsonencode in Matlab Analysis eat arrays.

First example reproduces the original string correctly:

json_inst = jsondecode ('{"array":[{"a":"b"},{"c":"d"}]}');
jsonencode (json_inst)

ans =

'{"array":[{"a":"b"},{"c":"d"}]}'

In the following example, codec eats the internal array in JSON structure:

json_inst = jsondecode ('{"array":[{"a":"b"}]}');
jsonencode (json_inst)

ans =

'{"array":{"a":"b"}}'

The second case must be a bug, because the result makes no sense.

October 11, 2018
2:18 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 442
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

jsonencode is definitely a MATLAB issue. I would have a look at MATLAB answers, or the doc for jsonencode.
https://www.mathworks.com/matlabcentral/answers/index
https://www.mathworks.com/help/matlab/ref/jsonencode.html

If you own a MATLAB license, you could contact support for help with this issue, depending on the terms of your license.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
48 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

Williampes, esmeraldagx11, lilacs16, loriexo60, ThomasHut, WernerDernnida

Administrators: Hans: 387, lee: 457