AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

JSON read/write parser
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Lexikos



Joined: 17 Oct 2006
Posts: 7288
Location: Australia

PostPosted: Sun Dec 21, 2008 2:11 pm    Post subject: Reply with quote

Thanks. The current behaviour is adequate for my use - always 'name':number. """name"":" expression repeated several times didn't appeal to me.
Back to top
View user's profile Send private message Visit poster's website
hughman



Joined: 11 Feb 2007
Posts: 166

PostPosted: Thu May 07, 2009 7:35 am    Post subject: Reply with quote

Thanks for the wonderful work, but I have some questions:
1.
what's meaning of (?-1)? reference in the opposite direction?
And what about q2 == "*" ?
And it doesn't need to escaped { } [ + in [^{}] , [^[\]] , ([+\-]?)?

2.
if the object string includes a ".", how to refer to it? For instance:
Code:

js = {"a.b.c":123}


3.
Quote:
z += p + StrLen(x2) - 2

should be
Quote:
z += p + StrLen(x2) + 2


4.
Quote:
If (!p := RegExMatch(j, "(?<!\\)(""|')([^\1]+?)(?<!\\)(?-1)\s*:\s*((\{(?:[^\{\}]++|(?-1))*\})|(\[(?:[^\[\]]++|(?-1))*\])|"
. "(?<!\\)(""|')[^\7]*?(?<!\\)(?-1)|[+\-]?\d+(?:\.\d*)?|true|false|null?)\s*(?:,|$|\})", x, p))

The red part should be [^\7] or [^\6]?

5. There're a lot of problems about array such as that it can get but can't set the value of array correctly.

Do you have a plan to update this function? If the parsing can be improved, then AHK will own a powerful and flexible function about associative array or table like LUA's.
Back to top
View user's profile Send private message
joelpt



Joined: 24 Jun 2009
Posts: 14

PostPosted: Fri Sep 18, 2009 12:44 am    Post subject: Reply with quote

I tried both the links in the first post of this thread to downlod json.ahk but neither link works. The more recent one comes up with a blank page.

Can anyone help?
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Fri Sep 18, 2009 6:01 pm    Post subject: Reply with quote

Try from Titan's Scripts.

HTH
Back to top
joelpt



Joined: 24 Jun 2009
Posts: 14

PostPosted: Fri Sep 18, 2009 6:14 pm    Post subject: Reply with quote

The bare link to json.ahk on that page also yielded an empty file, but opening it from the HTTP SVN link worked.

Thanks!!
Back to top
View user's profile Send private message
camerb



Joined: 19 Mar 2009
Posts: 547
Location: Texas, USA

PostPosted: Thu Jun 24, 2010 10:29 pm    Post subject: Reply with quote

Hott!
_________________
Aren't you glad that I didn't put an annoying gif here?
Back to top
View user's profile Send private message
hughman



Joined: 11 Feb 2007
Posts: 166

PostPosted: Fri Jun 25, 2010 8:16 am    Post subject: Reply with quote

If someone rewrites it with AHK_L, converts json to object, it must be more powerful, flexible and efficient. I wait it Smile
btw: AutoIt3 owns a udf library with full funtions
Back to top
View user's profile Send private message
EGM



Joined: 25 Jul 2010
Posts: 13

PostPosted: Sun Aug 29, 2010 4:00 pm    Post subject: Reply with quote

Curiously, does the json parser handle comments?
Back to top
View user's profile Send private message
polyethene



Joined: 11 Aug 2004
Posts: 5248
Location: UK

PostPosted: Sun Aug 29, 2010 4:05 pm    Post subject: Reply with quote

The JSON spec doesn't cover comments. If you mean JavaScript comments in JSON code then you can easily remove them with a simple regex.
_________________
GitHubScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
EGM



Joined: 25 Jul 2010
Posts: 13

PostPosted: Sun Sep 05, 2010 11:01 am    Post subject: Reply with quote

Thank you for the simple explanation, and for the JSON function, I've been having a lot of fun with it. Smile
Back to top
View user's profile Send private message
Wyrmskull
Guest





PostPosted: Wed Dec 01, 2010 7:45 pm    Post subject: Reply with quote

I'll paste some new AHK code for JSON parsing, importing and exporting,
and easy accessing as soon as I'll be able to post it complete. Confused
Back to top
lordkrandel



Joined: 12 Dec 2010
Posts: 30

PostPosted: Sun Dec 12, 2010 9:00 pm    Post subject: Reply with quote

Here is it

http://www.autohotkey.com/forum/viewtopic.php?t=66070
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group