How do I look up a hash value where the key includes a '.'? #40

Closed
jandubois opened this Issue Oct 19, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@jandubois

I have a hash keyed by URL, so I want to select like this:

$ json < tokens http://example.com

Is there a way to escape the '.' to make it part of the key value?

@trentm

This comment has been minimized.

Show comment Hide comment
@trentm

trentm Oct 19, 2012

Owner
$ echo '{"http://example.com": "foo"}' | json '["http://example.com"]'
foo

the same way that you need to do this:

$ node
> h = {"http://example.com": "foo"}
{ 'http://example.com': 'foo' }
> h["http://example.com"]
'foo'

I'll leave this ticket open to document that better.

Owner

trentm commented Oct 19, 2012

$ echo '{"http://example.com": "foo"}' | json '["http://example.com"]'
foo

the same way that you need to do this:

$ node
> h = {"http://example.com": "foo"}
{ 'http://example.com': 'foo' }
> h["http://example.com"]
'foo'

I'll leave this ticket open to document that better.

trentm added a commit that referenced this issue Oct 19, 2012

@trentm

This comment has been minimized.

Show comment Hide comment
@trentm

trentm Oct 19, 2012

Owner
Owner

trentm commented Oct 19, 2012

@trentm trentm closed this Oct 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment