toml4j icon indicating copy to clipboard operation
toml4j copied to clipboard

Add jackson support

Open mrniko opened this issue 9 years ago • 3 comments

It would be nice have jackson integration like yaml has https://github.com/FasterXML/jackson-dataformat-yaml

mrniko avatar Aug 03 '16 17:08 mrniko

If I understand correctly, jackson-dataformat-yaml is used to convert YAML to JSON. toml4j doesn't convert TOML to JSON. Is that the feature you're asking for?

Could the equivalent to com.fasterxml.jackson.dataformat.yaml.YAMLFactory be in a different project? I would prefer that solution. Calling Toml#toMap() and then using a JSON library to convert the Map to JSON seems easy enough to me and has the advantage of being library-agnostic. So I'd like to keep it out of the core.

mwanji avatar Aug 04 '16 10:08 mwanji

IMHO, yes, a seperate module is the way to go. I belive usually when people thin of a 'jackson module' its not quite about conversion to/from JSON, rather its integration to the jackson module system so that the full API's work (format agnostic). Every module does this a bit differently, sometimes vastly differently -- (I wish one coulud just pass a filename or mime-type to jackson and 'it worked' -- but not quite.)

Q: are there TOML constructs that do not map to JSON well? (tables?) A test of that is if a round-trip conversion from TOML->JSON->TOML preserves all 'important' data.
If the TOML data model is round-trippable to JSON then yes it should be fairly easy -- although a general purpose jackson dataformat module need do a little more than just convert to map ...

DALDEI avatar Aug 23 '18 05:08 DALDEI

Thanks for that explanation, @DALDEI . I really don't know very much about Jackson or it's module system, so I'm not sure what making "the full APIs work" really means, or how much work it would be.

mwanji avatar Sep 03 '18 09:09 mwanji