[
https://issues.apache.org/jira/browse/PIVOT-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884294#action_12884294
]
Greg Brown commented on PIVOT-549:
----------------------------------
A tilde is only valid when in quotes:
{ "~foo" : "bar" }
The JSON spec actually requires quotes around the keys, so a tilde is always a
valid identifier character. However, Pivot, like JavaScript, allows callers to
use unquoted identifiers as long as they conform to Java identifier rules:
{ ~foo: "bar" } // not OK
{ foo : "bar" } // OK
But note that this issue doesn't apply to the JSON format itself - it applies
to the JSON path syntax used by Pivot (and JavaScript) to access values in a
JSON structure (which isn't addressed by the JSON spec):
JavaScript:
var json = { "~foo" : "bar" };
var tildeFoo = json.~foo; // not OK
var tildeFoo = json["~foo"]; // OK
Pivot:
Object json = JSONSerializer.parse("{ '~foo' : 'bar' }");
Object tildeFoo = JSON.get(json, "json.~foo"); // not OK
Object tildeFoo = JSON.get(json, "json['~foo']"); // OK
> Storing to fields with data binding doesn't work
> ------------------------------------------------
>
> Key: PIVOT-549
> URL: https://issues.apache.org/jira/browse/PIVOT-549
> Project: Pivot
> Issue Type: Bug
> Components: core-beans
> Affects Versions: 1.5
> Reporter: Michael Allman
> Attachments: Field_Bug.tgz
>
>
> Pivot allows you to prefix a textKey attribute value with a "~" to indicate
> that that property should be accessed via the object's field. Currently, it
> doesn't work. When I try to do it, I get an IllegalArgumentException:
> Illegal identifier character.
> I'm attaching a test case Eclipse project. Run FieldBug, put some stuff in
> the fields or not, and press "Store". You should see the exception. Set a
> breakpoint on the JSON.split method and rerun the app in the debugger. Step
> through and you'll see where the exception is being thrown.
> Cheers.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.