hjson-go icon indicating copy to clipboard operation
hjson-go copied to clipboard

hjson-cli preserve comments

Open wfabianrs opened this issue 6 months ago • 1 comments

When using the json-cli tool, it removes comments from formatted code.

Using the following example file:

/*
A multi-line
comment
*/
{
  employer: “Yambee”  // inline comment
  address: “98563 Bobwhite Trail” # another inline comment
  description: “bibendum morbi non quam nec dui luctus rutrum nulla tellus in”
}

Running hjson-cli test.hjson returns:

{
  address: 98563 Bobwhite Trail
  description: bibendum morbi non quam nec dui luctus rutrum nulla tellus in
  employer: Yambee
}

Removing the comments written above

wfabianrs avatar Aug 26 '25 02:08 wfabianrs

That is the expected behavior. I've created a PR (#74) for a new parameter -preserveComments, have a look.

trobro avatar Aug 27 '25 16:08 trobro