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

extract value from property of json object with non alpha numeric characters #35

Open
low-decarie opened this issue Nov 2, 2014 · 1 comment

Comments

@low-decarie
Copy link

StackOverflow question

Example json file content in file /tmp/t

 [
    {
      "name:first"   : "trevor",
      "last"    : "wellington",
      "from"    : "england",
      "age"     : 52,
      "sports"  : [ "rugby", "badmitton", "snooker" ]
    },
    {
      "name:first"   : "yoni",
      "last"    : "halevi",
      "from"    : "israel",
      "age"     : 26,
      "sports"  : [ "soccer", "windsurfing" ]
    },
    {
      "name:first"   : "cory",
      "last"    : "parker",
      "from"    : "united states",
      "age"     : 31,
      "sports"  : [ "windsurfing", "baseball", "extreeeeme kayaking" ]
    }
  ]

This works fine
cat /tmp/t | jsawk -n 'out(this.last)'

But this does not
cat test.json | jsawk -n 'out(this.name:first)'

@flamusdiu
Copy link
Collaborator

Umm, this has to do with the ":" in the param name. If you replace with an underscore it works. Though, not what you want of course. But that's why it's currently failing in the second test.

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

2 participants