Categories > Coding > C# >

hello guys need help with cloud script hub

z_Kenneth

roachcock#3492

vip

Posts: 132

Threads: 13

Joined: Oct, 2021

Reputation: 5

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

  • 0

pepsi

PePsIDeveloper

vip

Posts: 260

Threads: 4

Joined: Apr, 2021

Reputation: 13

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.

  • 0

https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif

SeizureSalad

i love femboys

Posts: 1016

Threads: 73

Joined: Mar, 2021

Reputation: 37

Replied

@pepsi both of you guys suck at this

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

pepsi

PePsIDeveloper

vip

Posts: 260

Threads: 4

Joined: Apr, 2021

Reputation: 13

Replied

@66433works fine for me :)

  • 0

https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif

SeizureSalad

i love femboys

Posts: 1016

Threads: 73

Joined: Mar, 2021

Reputation: 37

Replied

@pepsi bro not the "it works tho" :sob:

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

z_Kenneth

roachcock#3492

vip

Posts: 132

Threads: 13

Joined: Oct, 2021

Reputation: 5

Replied

my bad, it works tho it's all that matters 

  • 1

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )