mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2003
Posts: 27
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Nov 2003
Posts: 27
Note: hoping that i don't find the answer right after posting a question again.

Problem: In my attempt to create my own JSON parses, i'm stumbling upon an annoying issue.

Code:
$bfind(&xdata, %json.mark, 125)


This does not return all positions. It returns the single }'s fine. The issue is that it does not return the paired }}'s and seems to simply ignore them.

And then i end up with sections that kind of look like item,item}}item,item,item

Any way to find the paired }}'s as well, using $bfind?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Can you post code to reproduce this?

Joined: Nov 2003
Posts: 27
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Nov 2003
Posts: 27
Code:
{"follows":[{"created_at":"2016-04-01T20:31:41Z","_links":{"self":"https://api.twitch.tv/kraken/users/uziell_uk/follows/channels/gottchar"},"notifications":false,"user":{"_id":39073814,"name":"uziell_uk","created_at":"2013-01-05T23:09:04Z","updated_at":"2016-04-02T17:00:56Z","_links":{"self":"https://api.twitch.tv/kraken/users/uziell_uk"},"display_name":"Uziell_UK","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/uziell_uk-profile_image-8295773db9a69296-300x300.png","bio":"The crazy random bearded Scotsman just doing his own thing!","type":"user"}},"_total":2704,"_links":{"self":"https://api.twitch.tv/kraken/channels/gottchar/follows?direction=DESC&limit=25&offset=0","next":"https://api.twitch.tv/kraken/channels/gottchar/follows?cursor=1458524807246948000&direction=DESC&limit=25"},"_cursor":"1458524807246948000"}


Now when using
Code:
var %json.mark = 547

the command
Code:
$bfind(&xdata, %json.mark, 125)

returns value 785, while it should return something lower.

The 785 gives me
Code:
,"display_name":"Uziell_UK","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/uziell_uk-profile_image-8295773db9a69296-300x300.png","bio":"The crazy random bearded Scotsman just doing his own thing!","type":"user"}},"_total":2704,"_links":


With the right value, it will return
Code:
,"display_name":"Uziell_UK","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/uziell_uk-profile_image-8295773db9a69296-300x300.png","bio":"The crazy random bearded Scotsman just doing his own thing!","type":"user"


Hopefully this is helpful.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
This one-liner gives me to the correct index of 559

Code:
//bset -t &b 1 {"follows":[{"created_at":"2016-04-01T20:31:41Z","_links":{"self":"https://api.twitch.tv/kraken/users/uziell_uk/follows/channels/gottchar"},"notifications":false,"user":{"_id":39073814,"name":"uziell_uk","created_at":"2013-01-05T23:09:04Z","updated_at":"2016-04-02T17:00:56Z","_links":{"self":"https://api.twitch.tv/kraken/users/uziell_uk"},"display_name":"Uziell_UK","logo":"https://static-cdn.jtvnw.net/jtv_user_pictures/uziell_uk-profile_image-8295773db9a69296-300x300.png","bio":"The crazy random bearded Scotsman just doing his own thing!","type":"user"}},"_total":2704,"_links":{"self":"https://api.twitch.tv/kraken/channels/gottchar/follows?direction=DESC&limit=25&offset=0","next":"https://api.twitch.tv/kraken/channels/gottchar/follows?cursor=1458524807246948000&direction=DESC&limit=25"},"_cursor":"1458524807246948000"} | echo -ag $bfind(&b,547,125)

Joined: Nov 2003
Posts: 27
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Nov 2003
Posts: 27
I get the same result as you with that command.
However, the file i'm using is too big to be using that. smirk


Link Copied to Clipboard