hjson/hjson-cpp

Order is not preserved.

Mr-Jonas opened this issue · 7 comments

First of all. thank you for making this.
hjson is vastly more fun to work with due to no "" all over.
Anyway, hjson-cpp seems to sort the hjson elements when i do
Value dat = Hjson::Unmarshal(hjsonStrInput);
std::string hjsonOut = Hjson::Marshal(dat);

I used it for an editor so it is very confusing that stuff moves around.
Is there any way to keep the actual order of the elements?
I used hjson for a templates system and the order is kinda important
as alphabetically will mess up the natural grouping.

I'm glad you like Hjson!

There is currently no way to keep the order, but maybe I can add it as an option to MarshalWithOptions().

Hi. That would be wonderful if it is possible with MarshalWithOptions(). Would fit right in there.
(i actually tried that as it sounded promising :)
Thank you in advance.

Hi, when I run function Unmarshal in multi-threads, why it consumes more time than in single thread?
any idea for this, thanks!

Hi, when I run function Unmarshal in multi-threads, why it consumes more time than in single thread?
any idea for this, thanks!

Hi, there's no special thread safety code in the Hjson implementation, but maybe there is in the standard library functions used. I can't think of any way to make Hjson faster in multi threading, sorry.

Added option preserveInsertionOrder for MarshalWithOptions. The default value is false, but I might change that to true in a future release 2.0.

Oh nice! cant wait to check it out. Then my "reformat" wont move things around. thank you.

Great, no problem!