Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty element name of subfield is replaced by toplevel element name. #324

Open
TobiasNx opened this issue Sep 14, 2023 · 1 comment
Open
Labels
Bug Something isn't working Metafix

Comments

@TobiasNx
Copy link
Collaborator

TobiasNx commented Sep 14, 2023

https://metafacture.org/playground/?flux=inputFile%0A%7C+open-file%0A%7C+as-records%0A%7C+decode-json%0A%7C+fix%28transformationFile%29%0A%7C+encode-json%28prettyPrinting%3D%22true%22%29%0A%7C+print%0A%3B&transformation=nothing%28%29&data=%7B%0A++++%22Hello%22%3A+%22World%22%2C%0A++++%22%22+%3A+%22This+is+an+empty+key%22%2C%0A++++%22some_key%22%3A+%7B%22%22%3A+%22bad+data+here%22%2C+%22ok%22%3A+%22I+am+ok%22%7D%2C%0A++++%22some_array%22%3A+%5B%7B%22%22%3A+%22bad+data+here%22%2C+%22ok%22%3A+%22I+am+ok%22%7D%2C%7B%22ok%22%3A+%22I+am+just+ok%22%7D%5D%0A%0A%7D

{
    "Hello": "World",
    "" : "This is an empty key",
    "some_key": {"": "bad data here", "ok": "I am ok"},
    "some_array": [{"": "bad data here", "ok": "I am ok"},{"ok": "I am just ok"}]

}

With fix nothing()

Results in:

{
  "Hello" : "World",
  "" : "This is an empty key",
  "some_key" : {
    "some_key" : "bad data here",
    "ok" : "I am ok"
  },
  "some_array" : [ {
    "1" : "bad data here",
    "ok" : "I am ok"
  }, {
    "ok" : "I am just ok"
  } ]
}

Should be:

{
  "Hello" : "World",
  "" : "This is an empty key",
  "some_key" : {
    "" : "bad data here",
    "ok" : "I am ok"
  },
  "some_array" : [ {
    "" : "bad data here",
    "ok" : "I am ok"
  }, {
    "ok" : "I am just ok"
  } ]
}
@TobiasNx TobiasNx added the Bug Something isn't working label Sep 14, 2023
@blackwinter
Copy link
Member

See also LibreCat/Catmandu#397 and LibreCat/Catmandu#398.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Metafix
Projects
Status: No status
Development

No branches or pull requests

2 participants