generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Getting Website API JSON to Lua Tables

Previous Thread :: Next Thread 
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 08:03 PM
So I got a link that returns all of roblox's limited items in JSON. How would I automatically convert it into a Lua Table? I tried the DecodeJSON function, but it doesn't like links in the arguments. Any help?

PS: I know this might belong in Scripting Helpers, but I don't think they would know

~ I be trollin ~
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
12 Feb 2013 08:13 PM
http://www.roblox.com/Serilized-Catalog-Data-item?id=106488204

Just take it and use it. Use DecodeJSON on the value, it'll return a table full of that page's data.

Check the item's 4th value to find out if it's limited.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 08:50 PM
Thanks I'll try it!

~ I be trollin ~
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 08:55 PM
Does it automatically update or do I have to do that manually?

~ I be trollin ~
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 09:10 PM
Hmm, so here's my script I renamed the name of the file to Catalog just to make it easier:

items = {}
limiteds = {}

Utl = assert(LoadLibrary("RbxUtility"))

for _,v in pairs(workspace.Catalog:GetChildren()) do
table.insert(items,Utl.DecodeJSON(v.Value))
end

for d,val in pairs(items) do
if items[d]==true then
table.insert(limiteds,val)
print(items[d][8] .. " was added to limiteds")
end
end

but I get an error:

RbxUtility:402: Invalid array: '[[27858204,0,true,false,true,false,0,"Rocketman","250","","1000"],[62231511,0,true,false,false,false,0,"Rockin' Headset","525","","1,765"],[15469575,0,true,false,false,false,0,"ROBLOX Warriors Football Helmet","40","","13,520"],[30200035,0,true,false,false,false,0,"ROBLOXian for Social Justice Cap","","37","209,510"],[15913837,0,true,false,false,false,0,"Roblohunk Hair","95","","7,620"],[43704873,0,true,false,true,false,0,"Soldier of Misfortune","275","","1000"],[13416646,0,true,false,false,false,0,"RobloFish(TM) Swim Goggles","33","","4,148"],[14719555,0,true,false,false,false,0,"Robber Baron Top Hat","5,000","","138"],[13837194,0,true,false,false,false,0,"Retro Gray Alien","74","","9,613"],[15726947,0,true,false,false,false,0,"Retro 3D Glasses","137","","14,525"],[15430705,0,true,false,false,false,0,"Renaissance Man","46","","410"],[15697477,0,true,false,false,false,0,"Reevee","85","","587"],[23726401,0,true,false,false,false,0,"Reese McBlox's Diary","67","","5,728"],[13121630,0,true,true,false,false,0,"Red Wizard Hat of Flames","99","","3103"],[13386707,0,true,false,false,false,0,"Real Rockin' Roller","53","","2,247"],[13335289,0,true,false,false,false,0,"Ranger Hat","32","","16,141"],[13745806,0,true,false,false,false,0,"Ram Horned Helm of Sir Ralston","426","","224"],[63643732,0,true,false,false,false,0,"Purple Pigtails","85","","264"],[20980282,0,true,false,false,false,0,"Prehistoric Hairdo","50","","371"],[30332157,0,true,false,false,false,0,"Pointy Boy Hair","35","","10,190"],[15133506,0,true,false,false,false,0,"Pointed Helm of "Ouch!"","50","","1,894"],[14515620,0,true,false,false,false,0,"Pink Pillbox Cap","90","","437"],[62722868,0,true,false,false,false,0,"Phoenix Mask","35","","1,546"],[25555262,0,true,false,false,false,0,"Pinky The Cyclops","99","","481"],[15637587,0,true,false,false,false,0,"Phantasmagorical Band Hat","","1,967","661"],[21804842,0,true,false,false,false,0,"Pemberley Punishers","44","","4,863"],[30845203,0,true,false,false,false,0,"Paper Space Ranger","11","","14,285"],[20643008,0,true,false,false,false,0,"Normal Hair","","65","355,362"],[13477818,0,true,false,false,false,0,"Normal Boy Hair","25","","44,935"],[62150694,0,true,false,true,false,0,"Winged Helm of the Northern Brothers","95","","1000"],[63692675,0,true,false,true,false,0,"Hooded Spacelord","21","","55"],[28998459,0,true,false,true,false,0,"Noob Attack: Katana Khaos","75","","2000"],[13477530,0,true,false,false,false,0,"NOMNOMNOM","187","","3,620"],[31541346,0,true,false,false,false,0,"Ninja Princess","175","","1,644"],[14767406,0,true,false,false,false,0,"Neon Pink Shuttershades","222","","17,439"],[15318115,0,true,false,false,false,0,"Neon Green Shuttershades","123","","81,875"],[13793909,0,true,false,false,false,0,"Neon Calaca","250","","189"],[28554581,0,true,false,false,false,0,"Navy Shuttershades","275","","11,803"],[16131017,0,true,false,false,false,0,"Mullet","112","","956"],[15430732,0,true,false,false,false,0,"Mr. Ribbit","96","","2,194"],[21392455,0,true,false,false,false,0,"Moonflower","150","","1,226"],[15967519,0,true,false,false,false,0,"Moai","60","","2,137"]]' due to: 'O'
19:09:53.964 - Script "RbxUtility", Line 402
19:09:53.969 - Script "RbxUtility", Line 393
19:09:53.970 - Script "Workspace.Script", Line 17
19:09:53.983 - stack end

Help? Quenty?

~ I be trollin ~
Report Abuse
lagbuilder is not online. lagbuilder
Joined: 16 Nov 2008
Total Posts: 838
12 Feb 2013 09:20 PM
Not sure if this will help, but I made this a while ago:

ItemTable = {}
CollectedData = {}
for i, v in pairs(ItemTable) do
local NewData = LoadLibrary('RbxUtility').DecodeJSON(tostring(v))
table.insert(CollectedData, NewData)
end
CompletedData = Instance.new("StringValue", game:GetService("Workspace"))
CompletedData.Name = "AssetData"
for i, v in pairs(CollectedData) do
local Name = Instance.new("StringValue", CompletedData)
Name.Name = tostring(v.Name)
for ii, vv in pairs(v) do
if ii ~= "Name" then
local Data = Instance.new("StringValue", Name)
Data.Name = tostring(ii)
Data.Value = tostring(vv)
end
end
end
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 09:34 PM
@lag, I can't figure out your script lol

~ I be trollin ~
Report Abuse
lagbuilder is not online. lagbuilder
Joined: 16 Nov 2008
Total Posts: 838
12 Feb 2013 09:40 PM
Basically, what I did was first seperate each table of values then use the JSON decoder.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Feb 2013 09:54 PM
Your script made a value in workspace, but nothing showed up. I made it autoadd the folder of string values into the first table, but nothing showed up as a child of the value.

//

Any help on my script?

[[ Usering ]]
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
12 Feb 2013 11:54 PM
Ran this script in the command line:

for _, Page in pairs(Workspace.qCatalogDataJSON:GetChildren()) do for _, Item in pairs(LoadLibrary("RbxUtility").DecodeJSON(Page.Value)) do print(Item[8]) end wait(0) print("Done with "..Page.Name) end

Got this error:

23:41:42.854 - RbxUtility:402: Invalid array: '[[27858204,0,true,false,true,false,0,"Rocketman","250","","1000"],[62231511,0,true,false,false,false,0,"Rockin' Headset","525","","1,765"],[15469575,0,true,false,false,false,0,"ROBLOX Warriors Football Helmet","40","","13,520"],[30200035,0,true,false,false,false,0,"ROBLOXian for Social Justice Cap","","37","209,510"],[15913837,0,true,false,false,false,0,"Roblohunk Hair","95","","7,620"],[43704873,0,true,false,true,false,0,"Soldier of Misfortune","275","","1000"],[13416646,0,true,false,false,false,0,"RobloFish(TM) Swim Goggles","33","","4,148"],[14719555,0,true,false,false,false,0,"Robber Baron Top Hat","5,000","","138"],[13837194,0,true,false,false,false,0,"Retro Gray Alien","74","","9,613"],[15726947,0,true,false,false,false,0,"Retro 3D Glasses","137","","14,525"],[15430705,0,true,false,false,false,0,"Renaissance Man","46","","410"],[15697477,0,true,false,false,false,0,"Reevee","85","","587"],[23726401,0,true,false,false,false,0,"Reese McBlox's Diary","67","","5,728"],[13121630,0,true,true,false,false,0,"Red Wizard Hat of Flames","99","","3103"],[13386707,0,true,false,false,false,0,"Real Rockin' Roller","53","","2,247"],[13335289,0,true,false,false,false,0,"Ranger Hat","32","","16,141"],[13745806,0,true,false,false,false,0,"Ram Horned Helm of Sir Ralston","426","","224"],[63643732,0,true,false,false,false,0,"Purple Pigtails","85","","264"],[20980282,0,true,false,false,false,0,"Prehistoric Hairdo","50","","371"],[30332157,0,true,false,false,false,0,"Pointy Boy Hair","35","","10,190"],[15133506,0,true,false,false,false,0,"Pointed Helm of "Ouch!"","50","","1,894"],[14515620,0,true,false,false,false,0,"Pink Pillbox Cap","90","","437"],[62722868,0,true,false,false,false,0,"Phoenix Mask","35","","1,546"],[25555262,0,true,false,false,false,0,"Pinky The Cyclops","99","","481"],[15637587,0,true,false,false,false,0,"Phantasmagorical Band Hat","","1,967","661"],[21804842,0,true,false,false,false,0,"Pemberley Punishers","44","","4,863"],[30845203,0,true,false,false,false,0,"Paper Space Ranger","11","","14,285"],[20643008,0,true,false,false,false,0,"Normal Hair","","65","355,362"],[13477818,0,true,false,false,false,0,"Normal Boy Hair","25","","44,935"],[62150694,0,true,false,true,false,0,"Winged Helm of the Northern Brothers","95","","1000"],[63692675,0,true,false,true,false,0,"Hooded Spacelord","21","","55"],[28998459,0,true,false,true,false,0,"Noob Attack: Katana Khaos","75","","2000"],[13477530,0,true,false,false,false,0,"NOMNOMNOM","187","","3,620"],[31541346,0,true,false,false,false,0,"Ninja Princess","175","","1,644"],[14767406,0,true,false,false,false,0,"Neon Pink Shuttershades","222","","17,439"],[15318115,0,true,false,false,false,0,"Neon Green Shuttershades","123","","81,875"],[13793909,0,true,false,false,false,0,"Neon Calaca","250","","189"],[28554581,0,true,false,false,false,0,"Navy Shuttershades","275","","11,803"],[16131017,0,true,false,false,false,0,"Mullet","112","","956"],[15430732,0,true,false,false,false,0,"Mr. Ribbit","96","","2,194"],[21392455,0,true,false,false,false,0,"Moonflower","150","","1,226"],[15967519,0,true,false,false,false,0,"Moai","60","","2,137"]]' due to: 'O'

Turns out the error is right here: [15133506,0,true,false,false,false,0,"Pointed Helm of "Ouch!"","50","","1,894"],


We can fix this by doing this:

[15133506,0,true,false,false,false,0,"Pointed Helm of \"Ouch!\"","50","","1,894"],

With escape characters. I'll modify my program and reupload the fixed version. I'll also update the catalog upon request, so all you have to do is insert it into your game, and when you want me to update it, I'll do it.


Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
13 Feb 2013 12:08 AM
I updated and fixed it. Huzzah.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
13 Feb 2013 04:54 AM
Does HttpGet works, with bindable function attached to command bar in online?
Report Abuse
Garnished is not online. Garnished
Joined: 09 Apr 2012
Total Posts: 12695
13 Feb 2013 08:50 AM
^
No, I know that hax.
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
13 Feb 2013 09:22 AM
Thanks, I'll test it later.
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
13 Feb 2013 02:58 PM
Roblox is producing invalid json, which is why `DecodeJSON` cannot parse it! This structure:

    [
        15133506,
        0,
        true,
        false,
        false,
        false,
        0,
        "Pointed Helm of " Ouch!"",
        "50",
        "",
        "1,894"
     ]

Contains the invalid string literal `"Pointed Helm of " Ouch!""`, which should be `"Pointed Helm of \" Ouch!\""`

Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
13 Feb 2013 03:04 PM
Actually, looks like that's _your_ invalid data, Quenty.
Report Abuse
TeamDman is not online. TeamDman
Joined: 04 Dec 2009
Total Posts: 897
13 Feb 2013 03:42 PM
So BindableFunctions + CommandBar will still work if you publish the place?
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
13 Feb 2013 07:32 PM
Quenty's list works good. Thanks.

I have a long script that determines if it's limited or limited u. Yes I did get the idea from Merely but I'm reproducing it myself (besides Quenty's catalog db)

Anybody wanna see it?

[[ Usering ]]
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
13 Feb 2013 07:35 PM
@NXTBoy

I know. If you actually read my post above, I also stated I fixed it. I also did the exact same solution you suggested. :/

Quote from my previous post: "Turns out the error is right here: [15133506,0,true,false,false,false,0,"Pointed Helm of "Ouch!"","50","","1,894"],


We can fix this by doing this:

[15133506,0,true,false,false,false,0,"Pointed Helm of \"Ouch!\"","50","","1,894"],"

Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
13 Feb 2013 08:00 PM
Eww f5'd

[[ Usering ]]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image