-
Notifications
You must be signed in to change notification settings - Fork 94
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
Jxon use #8
Open
mapa4
wants to merge
14
commits into
master
Choose a base branch
from
v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
starting pos in SubStr() during parsing of literal string(s).
- parse(): Improved validation of JSON source. Most (if all) common format errors are detected. As before, an exception is thrown. Code refactored. Added 'OutputNormal' class property to allow users to set whether returned object(s)/array(s) are sublclassed as JSON.object/JSON.array instance(s). Default is 'true' which returns instance(s) of JSON._object/JSON._array(notice the underscores) which are actually just normal AHK object(s) with no special behavior. - stringify(): A space is no longer added after a comma or colon if indent is not specified. Output is truly compact.
- parse(): Removed 'OutputNormal', '_object' and '_array' class properties. 'OutputNormal' has been replaced with 'jsonize' parameter. Defaults to 'false' which returns object(s) as normal/ordinary AHK object(s). - stringify(): Fixed output for empty object(s) when indentation is specified. No longer checks if an object is an instance of JSON.object or JSON.array as this will cause erroneous output if the user modifies the object's contents prior stringification. Minor optimization + changed some variable names.
- parse(): Changed parsing of true,false,null values -> no longer loops through each character to validate. Minor optimizations + code refactoring.
- Code refactored. - Removed previously kept commented old code parts.
Rewrote some parts -> changes mostly taken from Json2.ahk(master branch).
Apologies for the late response. If you're storing the "path" as a string(dot-delimited) such as "foo.1" and "its.over", you can do something like:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi CocoBelgica,
I experimented your Jxon function, thanks for creating it.
I was wondering if I could use it with JSON navigation strings stored in an ini file.
If for example my code is :
/*
[JSON] ; .INI File
Key1=hello
Key2=foo.1
Key3=its.over
*/
json_str = {"hello":"world","its":{"over":"9000"},"foo":["bar"]}
j := Jxon_Load(json_str)
msgbox % j.hello ; test1-1 ok
msgbox % j["hello"] ; (using Key1 equivalent of the above) : test1-2 ok
msgbox % j.foo.1 ; ok
msgbox % j.foo[1] ; test2-1 ok
;msgbox % ; (using Key2 equivalent of the above) : test2-2 ?
msgbox % j.its.over ; test3-1 ok
;msgbox % ; (using Key3 equivalent of the above) : test3-2 ?
What would be the equivalent syntax for test2-2 and test3-2 based on test1-2 syntax ?
Thanks in advance.
Best regards.