Streamerbot / docs

Official documentation for Streamer.bot
https://docs.streamer.bot
7 stars 45 forks source link

Parsing JSON Error in FetchURL #130

Closed prof-nobody closed 2 months ago

prof-nobody commented 2 months ago

Describe the bug Using API Ninjas the JSON response is not being parsed by Streamer Bot and is instead throwing an error. [2024-05-01 06:40:50.216 ERR] Unable to parse result as json, falling back to auto typing [{"fact": "Cows do not have any upper front teeth. Instead they have a thick pad on the top jaw"}] Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1. at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings) at _3i0Lzx2wqGliKlNC7CtMlJ3XEbJ._7FLWL4s233ypQDlEhdJDrtFUCrh.MoveNext()

To Reproduce Steps to reproduce the behavior:

  1. Create new action
  2. Create trigger
  3. Create sub action to fetch URL and configure it for API ninjas (https://api-ninjas.com/api/dadjokes) will need account setting the parse JSON option
  4. See error

Expected behavior It should parse the JSON and allow us to use the generated variables to access the data.

Desktop (please complete the following information):

Additional context It seems because it is returning as an array vs dictionary at the start that Streamerbot is having a challenge parsing the data.

Whipstickgostop commented 2 months ago

This repository is for documentation only.

You should open a #support thread in Discord if you need help with Streamer.bot application issues.