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

Variables with a period are not added to data to be sent in the JSON dump registration plugin #5041

Open
viktorvanwijk opened this issue Jan 27, 2025 · 2 comments

Comments

@viktorvanwijk
Copy link
Contributor

A textfield (or even user defined variable) with key foo.bar will be present in submission data as:

{
  "foo": {
    "bar": "baz"
  }
}

When selecting this variable in the options for the JSON dump registration plugin, it will show up as foo.bar. Currently, we iterate over all items in the submitted data, which will contain the key foo as it is a nested structure. Key foo will not be present in the list of variables to include, so it is not added.

See also: comment

@viktorvanwijk
Copy link
Contributor Author

viktorvanwijk commented Jan 27, 2025

Possible solutions in JSONDumpRegistration.register_submission():

  • Re-implement items() for FormioData to return the flat-key structure instead of the nested one (not sure if this is the general behaviour we want though)
  • Process the keys in options["variables"] to represent the nested data structure
  • Iterate over keys in options["variables"] instead of the FormioData.items(), as the lookup in the other direction does work. Probably the easiest, but it goes against the original philosophy of iterating over all available form variables.

@joeribekker
Copy link
Contributor

Refinement: Form field property name foo.bar will lead to a key in the JSON with the name foo.bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants