-
Notifications
You must be signed in to change notification settings - Fork 5
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
Nesting objects by prepending . #33
Comments
At first I thought I'd resolved my problem, but switching to array brackets creates a needless single-element array.
The desired way to access my properties would be e.g.
|
The problem is that, when in an array, using {objectName} causes the parser to lose its index in the array and return to the root object. Using {.objectName} doesn't help. In this way, objects are parsed differently than arrays. The only way I can see to handle this now is to use the full dot notation for each property. This is very repetitive. Nevertheless, in case this helps others, here is an example:
|
@martinburch I would like to see something like your first example. But I would expect
To be parsed like this: {
"colors": {
"reds": {
"crimson": "#dc143c",
"darkred": "#8b0000",
"blues": {
"cornflowerblue": "#6495ed",
"darkblue": "#00008b"
}
}
}
} Note that blues becomes nested inside reds because you didn't include a I would propose a syntax like so: The quote character could either act as a shorthand for "close the last opened object" or it could act as a reference to the first object that is opened. The benefit of that approach is that you get some idea of nesting level in the absence of significant white space. What do you think? |
Here's a PR that addresses the issue: newsdev/archieml-js#28 |
I'd like to write something like this, but it doesn't seem to be supported.
The
reds
andblues
are ignored and everything becomes properties of thecolors
object.The docs show this example, which repeats
colors
. Any way to avoid this repetition?The output in both cases would be expected to be:
Thanks,
Martin
The text was updated successfully, but these errors were encountered: