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

Problem handling underscores in field names? #3

Closed
stevec64 opened this issue Sep 21, 2012 · 1 comment
Closed

Problem handling underscores in field names? #3

stevec64 opened this issue Sep 21, 2012 · 1 comment
Labels

Comments

@stevec64
Copy link

I tried this:

$ jq '.data[1].target_platform' < mata.txt 

error: Invalid character
.data[1].target_platform
               ^
error: syntax error, unexpected IDENT, expecting $end
.data[1].target_platform
                ^^^^^^^^
2 compile errors

The input is a vanilla JSON file with entries like:

{
    "target_country_code": [ "US" ],
    "day": "2012-09-21",
    "campaign_name": "Best Game Ever campaign-11",
    "spend": 663,
    "bundle_id": "com.foo.best_game",
    "target_manufacturer": [ "Samsung" ],
    "clicks": 12,
    "downloads": 6,
    "campaign_id": 11,
    "app_id": "12341",
    "currency": "USD",
    "impressions": 30,
    "target_platform": [ "Nexus S", "阿里云" ]
}
@stroan
Copy link
Contributor

stroan commented Sep 21, 2012

That should definitely parse. As a workaround you can do:

jq '.data[1]["target_platform"]' < mata.txt

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

No branches or pull requests

4 participants