chrisbu / dartwatch-JsonObject

JsonObject which allows dot notation access to JSON.parse'd objects. Read the article on http://www.dartlang.org/articles/json-web-service/
http://www.dartlang.org/articles/json-web-service/
MIT License
83 stars 25 forks source link

access JSON element with a _ or @ in the name #30

Open fils opened 11 years ago

fils commented 11 years ago

I am working with JSON_LD which has elements like @context and _links in it.

I can get dart var sr = data.links; to work but dart var sr = data._links; or var sr = data.'_links'; don't..

is there a way to access elements of json with non alpha numeric first characters?

shamblett commented 11 years ago

Same here, I'm seeing this error with the '_' as the first character, CouchDB uses fields like '_rev' for instance, these don't play nicely maybe because Dart sees '_rev' as a private member and can't return it publicly without a getter?

stevenroose commented 9 years ago

Weird. I'd think a _private getter would still pass through noSuchMethod.

You can always use the Map function data["_links"].