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

Generate dynamic key names #4

Open
grational opened this issue Jun 22, 2015 · 0 comments
Open

Generate dynamic key names #4

grational opened this issue Jun 22, 2015 · 0 comments

Comments

@grational
Copy link

I'm trying to convert a json alike the next:

{ "formParameter": [
          {"name": "email", "value": "[email protected]"},
          {"name": "phone", "value": "+01 12 345 67 89"},
          {"name": "address", "value": "1234 Placename"}
      ]
}

into this:

{  "sender": {
       "email": "[email protected]",
       "phone": "+01 12 345 67 89",
       "address": "1234 Placename"
   }
}

but i can't find a way to use the value of &$.formParameter[x].name as the key of the output json.
That is because anything i put before the comma is considered as a simple string (is not evaluated by json2json).

Using XSLT my problem is solvable using the following XSL instruction:

<xsl:element name="{@Name}">

You can find an application of this at:
http://stackoverflow.com/a/7922068/4892253

Is this supported at the moment? Can you suggest how to proceed?

Thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant