akkadotnet / HOCON

C# implementation of Lightbend's HOCON (Human-Optimized Object Configuration Notation)
Apache License 2.0
138 stars 39 forks source link

Render Hocon as JSON #87

Open iron9light opened 5 years ago

iron9light commented 5 years ago

Java version Hocon can render Hocon element as JSON ( https://github.com/lightbend/config/blob/master/config/src/main/java/com/typesafe/config/ConfigRenderOptions.java )

Can akkadotnet Hocon provide the same feature?

Arkatufus commented 5 years ago

No, there is no support for rendering HOCON into JSON. HOCON is not supposed to be backward compatible with JSON.

iron9light commented 5 years ago

@Arkatufus Oh! really?! Then why lightbend can do this? And I just create concept-proven project: https://github.com/iron9light/HOCON.Json Check it out :-P

Arkatufus commented 5 years ago

Well, you could make a PR, and we can discuss it further?

iron9light commented 5 years ago

Well, I've tried to transfer Hocon to Json.Net, it works so far. (I've used it in my private project). But the better way should be something similar to what's Java's Hocon done. Should be part of PrettyPrint. Then it doesn't need to depend on the 3rd lib.

Did this project copy from Java's Hocon line by line? If not (my understanding is NOT), why not? And will take more effort to port this feature to Hocon.Net.

Arkatufus commented 5 years ago

Yes, this is our own parser, based on the Hocon specification documentation. Making the feature part of PrettyPrint is a good idea, you can pass parameters and generate the proper string output from it.