Not a well-formed list of pairs - except it is

Hi!
I want to get some JSON data.

This is what the data looks like:

This is what it looks like when checking the data the error message shows:

Raw data:

[{'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '5', 'subject': 'Kra', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK4', 'teacher': 'R233', 'col8': 'EF GK4 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '5', 'subject': 'Tre', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK2', 'teacher': 'R234', 'col8': 'EF GK2 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '6', 'subject': 'Tre', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK4', 'teacher': 'R233', 'col8': 'EF GK4 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '6', 'subject': 'Kra', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK2', 'teacher': 'R234', 'col8': 'EF GK2 D (Tre)', 'col9': '---'}]

Easy to read data:

[
   {
      "date":"13.12.2021",
      "day":"Montag",
      "updated":"10.12.2021 12:59",
      "type":"13.12.",
      "class":"EF",
      "lesson":"5",
      "subject":"Kra",
      "room":"---",
      "new_subject":"---",
      "new_teacher":"D GK4",
      "teacher":"R233",
      "col8":"EF GK4 D (Tre)",
      "col9":"---"
   },
   {
      "date":"13.12.2021",
      "day":"Montag",
      "updated":"10.12.2021 12:59",
      "type":"13.12.",
      "class":"EF",
      "lesson":"5",
      "subject":"Tre",
      "room":"---",
      "new_subject":"---",
      "new_teacher":"D GK2",
      "teacher":"R234",
      "col8":"EF GK2 D (Tre)",
      "col9":"---"
   },
   {
      "date":"13.12.2021",
      "day":"Montag",
      "updated":"10.12.2021 12:59",
      "type":"13.12.",
      "class":"EF",
      "lesson":"6",
      "subject":"Tre",
      "room":"---",
      "new_subject":"---",
      "new_teacher":"D GK4",
      "teacher":"R233",
      "col8":"EF GK4 D (Tre)",
      "col9":"---"
   },
   {
      "date":"13.12.2021",
      "day":"Montag",
      "updated":"10.12.2021 12:59",
      "type":"13.12.",
      "class":"EF",
      "lesson":"6",
      "subject":"Kra",
      "room":"---",
      "new_subject":"---",
      "new_teacher":"D GK2",
      "teacher":"R234",
      "col8":"EF GK2 D (Tre)",
      "col9":"---"
   }
]

This is what I’m doing with the data:

Thank you for any help!

Using [Free] Json To Dictionary Extension

That means the source data is okay… hrm. The issue is that I want to cycle through each block the API gives me to cache it, so just walking through everything won’t work sadly. I will try that extension, thank you!

Nope, sorry.

Error:

Lookup in pairs: the list [{"class":"EF","col8":"EF GK4 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"5","new_subject":"---","new_teacher":"D GK4","room":"---","subject":"Kra","teacher":"R233","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK2 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"5","new_subject":"---","new_teacher":"D GK2","room":"---","subject":"Tre","teacher":"R234","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK4 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"6","new_subject":"---","new_teacher":"D GK4","room":"---","subject":"Tre","teacher":"R233","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK2 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"6","new_subject":"---","new_teacher":"D GK2","room":"---","subject":"Kra","teacher":"R234","type":"13.12.","updated":"10.12.2021 14:31"}] is not a well-formed list of pairs

Blocks:

Edit:
The error seems to occur in the if statement since after some more debugging it is the only thing accessing anything.

Where is key error ? In above provided json I do not see such a key. Json is an array with many objects. If you wish to check in a loop maybe try like this

I do that to check if the key “error” exists. It occurs if any error was made and the API cannot work with the data given. I changed it to below blocks, my error still occurs though.

image

Example request containing tag “error”:

{"error":"Not enough args","errorcode":1}

Also I would rather choose the for-loop, it is just easier to use although I will try with the one provided by you.
Edit: Nope, does not fix the issue.

Let me understand, responce is in the form of either
1

{"error":"Not enough args","errorcode":1}

or 2 ?

[{'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '5', 'subject': 'Kra', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK4', 'teacher': 'R233', 'col8': 'EF GK4 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '5', 'subject': 'Tre', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK2', 'teacher': 'R234', 'col8': 'EF GK2 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '6', 'subject': 'Tre', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK4', 'teacher': 'R233', 'col8': 'EF GK4 D (Tre)', 'col9': '---'}, {'date': '13.12.2021', 'day': 'Montag', 'updated': '10.12.2021 12:59', 'type': '13.12.', 'class': 'EF', 'lesson': '6', 'subject': 'Kra', 'room': '---', 'new_subject': '---', 'new_teacher': 'D GK2', 'teacher': 'R234', 'col8': 'EF GK2 D (Tre)', 'col9': '---'}]


Or error key might be present in some objects in json response ?

You are right. It is either 1 or an array of results (in JSON form) which can be empty but, using the test data, is not.

Then you could try like this

I did some edits.
This is the error:

List of pairs to dict: the list [{"class":"EF","col8":"EF GK4 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"5","new_subject":"---","new_teacher":"D GK4","room":"---","subject":"Kra","teacher":"R233","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK2 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"5","new_subject":"---","new_teacher":"D GK2","room":"---","subject":"Tre","teacher":"R234","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK4 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"6","new_subject":"---","new_teacher":"D GK4","room":"---","subject":"Tre","teacher":"R233","type":"13.12.","updated":"10.12.2021 14:31"}, {"class":"EF","col8":"EF GK2 D (Tre)","col9":"---","date":"13.12.2021","day":"Montag","lesson":"6","new_subject":"---","new_teacher":"D GK2","room":"---","subject":"Kra","teacher":"R234","type":"13.12.","updated":"10.12.2021 14:31"}] is not a well-formed list of pairs

Those are the blocks:

I cannot even get this far.

If you wish pm me your aia or a test aia to give it a look

Solved by @dora_paz via DM. Thank you!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.