# MATLAB: How to get jsondecode to preserve map keys (numerical keys are prefixed with ‘x’)

errorjsonjsondecodejsonencodekeymapMATLAB

Hi,
Could someone explain why this happens:
jsonencode(jsondecode('{"a":"b"}'))% '{"a":"b"}' (works as one would assume)jsonencode(jsondecode('{"1":"b"}'))% '{"x1":"b"}' (numeric value is previxed with 'x')jsonencode(jsondecode('{"a.b":"b"}')) % '{"a_b":"b"}' ('.' is converted to '_')
And how to work around it?
Some context:
I'm utilising a web api endpoint to post data, and it requires the data in similar format that in the second case above. But I'm not able to produce reliably the json payload (the example is a simplification of the actual problem)
Thanks