-
Notifications
You must be signed in to change notification settings - Fork 116
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
Some strings returned as "string" class instead of "char" in recent matlab versions #50
Comments
hi @jobh, thanks for the comment. can you give me a short example showing this issue? I am also curious if adverse-effect if we leave it as "string"? |
Since char and string have different behaviors in Matlab, you could encounter adverse effects in a downstream program which uses the loaded JSON object. A simple example would be a function which checks the input type using Since JSON does not permit single quote strings, the only way to resolve string vs. char would be to encode the type with the variable. Note that the neither built-in |
right now, I don't see a problem storing strings as char array in JSON since there is no difference in JSON's specification. I do see a problem when one tries to store a string array, jsonlab can raise an error, but I think it should be fixed now after this commit by treating string arrays as a cell. https://github.com/fangq/jsonlab/commit/ed2645e558c510b806c738de8b9dc71096a708ae |
fixed. A user now can use ParseStringArray=1 or 0 to choose parsing string array or convert to char array. default is covert to char array (ParseStringArray=0). Try
and
an alternative is to disable the fastarrayparser using
|
Arrays of strings are parsed by matlab's
eval
, and since they use double quotes they end up asstring
instead ofchar
starting from 2017a.A simple fix is to convert them back at the end, something like the following in loadjson.m (after parsing):
The text was updated successfully, but these errors were encountered: