dartwatch-JsonObject
dartwatch-JsonObject copied to clipboard
access JSON element with a _ or @ in the name
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?
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?
Weird. I'd think a _private
getter would still pass through noSuchMethod
.
You can always use the Map function data["_links"]
.