remarshal-project / remarshal

Convert between CBOR, JSON, MessagePack, TOML, and YAML

Home Page:https://pypi.org/project/remarshal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse error

raine opened this issue · comments

https://github.com/toml-lang/toml#example

Near line 7 (last key parsed 'owner.dob'): Expected 'Z' in ISO8601 datetime, but found '-' instead.
# This is a TOML document.

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00 # First class dates

[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true

[servers]

  # Indentation (tabs and/or spaces) is allowed but not required
  [servers.alpha]
  ip = "10.0.0.1"
  dc = "eqdc10"

  [servers.beta]
  ip = "10.0.0.2"
  dc = "eqdc10"

[clients]
data = [ ["gamma", "delta"], [1, 2] ]

# Line breaks are OK when inside arrays
hosts = [
  "alpha",
  "omega"
]

At this point Remarshal only supports TOML v0.2.0, which requires that the "Z" be there in the date. This is due to the TOML library on which Remarshal relies implementing that version of the format.

I will keep this issue open until the library is updated to support TOML v0.4.0 or until I find a suitable replacement (one that supports reflection).

Thanks!

This might not be the best place for this, but I'm wondering since the Burntsushi/toml library hasn't moved forward in a while what the problem would be to converting this to use the naoina/toml library. I'm trying to get it worked in but I'm not the best Go programmer.

Would this be a desired change or is the desire to continue using the burntsushi library?

If naoina/toml can unmarshal arbitrary data (i.e., not just predefined structs) like BurntSushi/toml can then I have no objections to replacing BurntSushi/toml with it. I will gladly accept your pull request if you do and it passes the tests in tests.sh.

That said, from looking at the documentation it seems to me that naoina/toml only works with predefined structs.

@dbohdan I believe this is true. This leads me to probably go down the avenue of trying to see what is required to resolve the issue in BurntSushi/toml.

If I get it working in either, I'll update here.

Thanks

remarshal has been rewritten in Python. The newest version supports TOML 0.4.