SReject / JSON-For-Mirc

JSON parser for mIRC
19 stars 6 forks source link

$JSON doesn't parse if "." and "_" used #14

Closed westor7 closed 7 years ago

westor7 commented 8 years ago

Hello,

I was creating an code and i saw that , the $JSON does not parsing an value that contains $chr(46) and $chr(95) together into the value.

JSON Version: 0.2.41 mIRC Version: 7.45.438


Check this photo: http://goo.gl/ryg8JZ It cannot read the "status.id_str" value and other values that contains . and _ together.

Debugging Error: debug error: [twitter_38300] $JSON( twitter_38300, users, 0, status.id_str) --RAISED-- Reference doesn't exist


Test Code:

alias test_json {
  var %v = twitter_ $+ $rand(1,100000)
  var %s = $chr(123) "username": " $+ westor7 $+ " $+ $chr(44) "is_id": false $+ $chr(44) "as_table": false $chr(125)

  jsonopen -wud %v https://run.blockspring.com/api_v2/blocks/twitter-user-info?api_key=br_33699_151ad820afe951291e4c35e43654e691824d71df
  if ($jsonerror) { echo error -- $jsonerror | return }

  jsonurlmethod %v POST
  jsonurlheader %v Host run.blockspring.com
  jsonurlheader %v User-Agent */*
  jsonurlheader %v Accept */*
  jsonurlheader %v Content-Type application/json
  jsonurlheader %v Content-Length $len(%s)
  jsonurlget %v %s

  if ($jsonerror) { echo error2 -- $jsonerror | return }

  var -s %id = $json(%v,users,0,id)

  var -s %test = $json(%v,users,0,status.id_str)
}

Server RAW JSON reply data:

{"_blockspring_spec":true,"_errors":[],"users":[{"id":111060136,"id_str":"111060136","name":"Dimitris Psirrakis","screen_name":"westor7","location":"Greece","description":"Δημήτρης Ψηρράκης,\r\n\r\nΚατάγωμαι απο την Αλεξανδρούπολη. \r\n\r\nΚαι πολλά σας είπα!","url":"http://t.co/Q9tmtFCdhX","entities.url.urls":[{"url":"http://t.co/Q9tmtFCdhX","expanded_url":"http://www.fb.me/westor7","display_url":"fb.me/westor7","indices":[0,22]}],"entities.description.urls":[],"protected":false,"followers_count":50,"friends_count":337,"listed_count":2,"created_at":"Wed Feb 03 17:39:46 +0000 2010","favourites_count":0,"utc_offset":10800,"time_zone":"Athens","geo_enabled":true,"verified":false,"statuses_count":125,"lang":"en","status.created_at":"Thu Jun 18 23:24:29 +0000 2015","status.id":611675883397484500,"status.id_str":"611675883397484545","status.text":"@pastieorg Add support for mIRC scripting language...","status.truncated":false,"status.source":"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>","status.in_reply_to_status_id":null,"status.in_reply_to_status_id_str":null,"status.in_reply_to_user_id":569883774,"status.in_reply_to_user_id_str":"569883774","status.in_reply_to_screen_name":"pastieorg","status.geo":null,"status.coordinates":null,"status.place":null,"status.contributors":null,"status.is_quote_status":false,"status.retweet_count":0,"status.favorite_count":0,"status.favorited":false,"status.retweeted":false,"status.lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"ACDED6","profile_background_image_url":"http://abs.twimg.com/images/themes/theme18/bg.gif","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme18/bg.gif","profile_background_tile":false,"profile_image_url":"http://pbs.twimg.com/profile_images/1580027432/avatar_1997_normal.jpg","profile_image_url_https":"https://pbs.twimg.com/profile_images/1580027432/avatar_1997_normal.jpg","profile_link_color":"038543","profile_sidebar_border_color":"EEEEEE","profile_sidebar_fill_color":"F6F6F6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false}]}

SReject commented 7 years ago

Solved with c1bbf11a9433502461e89a6e8094deebe0cdcc9a