Canop / deser-hjson

A Serde 1.0 compatible Rust deserializer for Hjson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Braceless hjson not supported

bend-n opened this issue · comments

commented
a: 4

is valid hjson.

This is not supported by this crate.
It errors with

Syntax { line: 1, col: 2, code: ExpectedMap, at: ": 4\n" }

Thanks, I hadn't noticed it was allowed again.

Hjson allows you to omit {} for the root object so that a config file can contain nothing but keys and values, similar to YAML.
Note: This feature was previously marked as deprecated but is now officially supported again. If you need maximum portability with your Hjson files, then we recommend you keep the root braces in case a third party implementation doesn't support it.

I'll have a look and try to support braceless Hjson.

It seems to work: #8

Code isn't really pretty, but seems OK.

If you think about other cases than the ones in the tests, don't hesitate to make suggestions.

BTW I've tested it in Broot and I like that I can remove an indentation level, so I should publish a new version soon enough if we don't find problems.