v4.3.0
Two new public structs of interest: hjson.OrderedMap and hjson.Node.
hjson.OrderedMap can be used as destination or source for all Hjson unmarshal and marshal functions (if the root value is a map/object), and also for the unmarshal and marshal functions of the standard package json
. hjson.OrderedMap is similar to map[string]interface{}
, but preserves key order.
hjson.Node can also be used as destination or source for all Hjson unmarshal and marshal functions, and also for the unmarshal and marshal functions of the standard package json
. The struct is simply a wrapper for the actual value and a helper struct containing any comments, allowing comments and custom indentation to be preserved if you read in a document, change a value, and then save the document again. hjson.Node has several convenience functions, for example AtIndex() or SetKey() that can be used when you know that the node contains a value of type []interface{}
or *hjson.OrderedMap.
Other changes:
- Added argument
-preserveKeyOrder
to the tool hjson-cli - Added field DisallowDuplicateKeys (default
false
, which means that later values overwrite earlier values) to the DecoderOptions struct - Added field WhitespaceAsComments (default
true
) to the DecoderOptions struct - hjson-go no longer supports Go 1.11
Tested on Go 1.12 - 1.19