wtfsmd Posted April 19, 2010 Share Posted April 19, 2010 I am trying to write a script that will parse this {"min_ep": 0, "realm": "Windrunner", "roster": [["Aeroch", 31301, 1864], ["Agita", 29693, 1568], ["Aladon", 26355, 580], ["Angslan", 33567, 2168], ["Auringuarde", 24598, 1136], ["Berdy", 34194, 1444], ["Blackguard", 19275, 2382], ["Bloodferal", 20628, 1679], ["Carahalint", 32447, 236], ["Carthro", 24071, 382], ["Darkruler", 30084, 1263], ["Drfox", 12617, 1027], ["Ender", 32444, 1178], ["Enragedlol", 1064, 532], ["Ewrakilr", 33562, 1793], ["Gatgat", 31973, 2268], ["Gumb\u00f3", 30015, 1258], ["Helorus", 34106, 320], ["Holycritts", 11506, 960], ["Immaculate", 28270, 457], ["Kjaer", 33112, 1177], ["Lobeless", 15166, 448], ["L\u00ecverlips", 22474, 876], ["L\u00edl\u00ecanna", 15914, 1068], ["Nazarriel", 12780, 1200], ["Nikoro", 31390, 1568], ["Perrun", 27334, 1281], ["Psylox", 4250, 1200], ["Pwnyride", 5570, 800], ["Ramzza", 28025, 1307], ["Relaxn", 18044, 816], ["Sarmation", 8054, 788], ["Seductive", 17134, 1165], ["Slidera", 30923, 1189], ["Stormdrifter", 30501, 888], ["Valaria", 29197, 1209]], "timestamp": 1271554980, "region": "us", "base_gp": 1, "extras_p": 100, "guild": "Genesis", "decay_p": 20} I would like to extract and separate all of the information so that i can insert into a MySQL DB this would be the chunk ["name" 0, 0] that i need to separate, thanks for any help! Link to comment https://forums.phpfreaks.com/topic/199069-need-some-help-parsing-a-string/ Share on other sites More sharing options...
premiso Posted April 19, 2010 Share Posted April 19, 2010 This is a json array. If your server is setup to have the json functions json_decode will work. If not, on the json_decode page in the user comments someone provided the code for the function that will act like json_decode would. Link to comment https://forums.phpfreaks.com/topic/199069-need-some-help-parsing-a-string/#findComment-1044899 Share on other sites More sharing options...
wtfsmd Posted April 20, 2010 Author Share Posted April 20, 2010 Thank-you for your reply! Link to comment https://forums.phpfreaks.com/topic/199069-need-some-help-parsing-a-string/#findComment-1044963 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.