Hi everybody.
I have using ActiveSupport::JSON library in rails
I have a json string:
test= {“C1”:{“id”:“C1”,“mode”:“new”,“type”:“block”,“name”:“new block
C1”,“unit”:"",“choices”:[],“index”:10},“R1”:{“id”:“R1”,“mode”:“new”,“type”:“text”,“name”:“new
question
R1”,“unit”:"",“choices”:[""],“index”:20},“R2”:{“id”:“R2”,“mode”:“new”,“type”:“text”,“name”:“new
question
R2”,“unit”:"",“choices”:[""],“index”:30},“R3”:{“id”:“R3”,“mode”:“new”,“type”:“text”,“name”:“new
question
R3”,“unit”:"",“choices”:[""],“index”:40},“C2”:{“id”:“C2”,“mode”:“new”,“type”:“block”,“name”:“new
block
C2”,“unit”:"",“choices”:[],“index”:50},“R4”:{“id”:“R4”,“mode”:“new”,“type”:“text”,“name”:“new
question
R4”,“unit”:"",“choices”:[""],“index”:60},“C3”:{“id”:“C3”,“mode”:“new”,“type”:“block”,“name”:“new
block C3”,“unit”:"",“choices”:[],“index”:70}}
when i using:
temp = ActiveSupport::JSON
result = temp.decode(test)
and I recieve: Result is not sort the same as param “test” i had before.
result =“R2choicesnamenew question
R2modenewunittypetextidR2index30R3choicesnamenew question
R3modenewunittypetextidR3index40R4choicesnamenew question
R4modenewunittypetextidR4index60C1choicesnamenew block
C1modenewunittypeblockidC1index10C2choicesnamenew block
C2modenewunittypeblockidC2index50C3choicesnamenew block
C3modenewunittypeblockidC3index70R1choicesnamenew question
R1modenewunittypetextidR1index20”
I dont understand it.
Please tell me a solution.
Thanks for help.