Categories > Coding > C# >
hello guys need help with cloud script hub
Posted
so it is 230 am rn and my bran going nuts i am using rbxscripts.xyz, i've successfully pulled the script title, the execution link, the id, etc.. but i am rn struggling with the "featured_image" part, here is the exception i am getting:
Newtonsoft.Json.JsonReaderException: 'Unexpected character encountered while parsing value: {. Path '[0].featured_image', line 1, position 361.'
the exception is prolly coming from here:
"featured_image":{"thumbnail":"https:\/\/rbxscripts.xyz\/wp-content\/uploads\/2022\/08\/Png-55-pt6ozw1px1upvnxw3c6nxurgotfg13tpvlyz8vc53s-150x124.png"}}
here is the api link if u wanna ctrl+f it for me:
https://rbxscripts.xyz/wp-json/wl/v1/posts/
var _api = JsonConvert.DeserializeObject<IList<ScriptLinks>>(wc.DownloadString("https://rbxscripts.xyz/wp-json/wl/v1/posts/"));
foreach(var dep in _api)
{
MessageBox.Show(dep.Id.ToString() + "\n" + dep.title + "\n" + dep.excerpt + "\n" + dep.date + "\n" + dep.slug);
}
code worked before, but am too tired to yknow find a solution, just tryna test thngs out rn with a messagebox, i also have never used json in my entire life so its rlly complicated pls help me find me a solution and please enlighten me on what i should do differenly. thanks
Replied
I do it like this
dynamic json = JsonConvert.DeserializeObject(WC.DownloadString("https://rbxscripts.xyz/wp-json/wl/v1/posts/"));
foreach (var item in json)
{
CreateScript(item.title.ToString(), item.featured_image.thumbnail.ToString(), item.excerpt.ToString());
}
Yes it looks the same but if this works for me it should work for you. The create script part is where you change it up since its my own function.
Cancel
Post
https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
@66433works fine for me :)
Cancel
Post
https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
my bad, it works tho it's all that matters
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post