npm / ini

An ini parser/serializer in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encode + decode of array containing object failed!

alinex opened this issue · comments

I have the following data structure:

{ persons: [{ name: 'Egon' }, { name: 'Janina' }] }

After encoding I got:

persons[]={"name":"Egon"}
persons[]={"name":"Janina"}

And after decoding again I got:

{ persons: [ '{"name":"Egon"}', '{"name":"Janina"}' ] }

Meaning the content of the list entries is kept as string and not converted into objects again.

I solved this myself by converting arrays to objects with numbered keys before encoding. Also back converting to real arrays after decoding works fine.