I don't know why it's showing:"Argument must be valid a json"

"Argument must be valid Json"
I researched here in the forum, before posting: [Firebase + JSONTools] How to get a value from response?
I installed the JsonTools and JsonUtils extensions. The response content comes from the php script.
I display the content in a textbox.
But, the message from “Argument must be valid Json” is still displayed. What I want: Return the value of 2 fields from 2 tables in the database and show the app user. Return to Json but I don’t know why this message is returning.
jsonreturn
My code :
retornojson

Use only once the Parse JSON block with the global

Then try the Get String Value block with Do It

Then try the Get String Value block with Do It

“Do it” is a block of which component?
I tested like this, and it was empty
jsonreturn2

I think you will get an array after parsing response content.

I need to learn how to get values ​​returned from the database to be used in the app. See I made another screen in less than 15 minutes, where I look for the amount of students present and absent in the classroom, but I’m not able to manipulate this return.
I want to put the returned values ​​(in the example below) on their labels.

I really didn’t understand what the ParseJson method does with the parameter passed to it. Does it do something and return or save this change where?

Actually I am not very good in Parsing JSON or using JSON.
Can you send me response content?
Then I can answer your question.

This topic should help you regarding JSON:

With these same returns (in another app), I manipulate using the Add Items To List loop + Look Up in Pairs key and save it to a list and this list show it in a LISTVIEW. But in this specific case, I just need to take the value and use it in the app.
jsonreturn4
jsonreturn5

If it is saved as list then use select list item block.

I did so but …

codigo5
Error:

Response content :
codigo6

Please post here Response content as text in reply.

It’s that…
[{“CNOMEFUNC”:“RAFAEL PEIXOTO PEREIRA”},{“cnomemat”:“MODULO PRATICO”}]


I put Response Content on this Json parser … it looks all ok.

Here too all ok

First parse array one by one and then get desired value.

Hint:- use loops to make it easy

But it gives me this error:

Parse error on line 1: [{“CNOMEFUNC”:“RAFAEL --^ Expecting 'STRING', '}', got 'undefined'

Dear , is Very stranger. Expecting String ? The word “RAFAEL” is in quotes and the return comes PHP function json_encode that is the same function I use in the others app.

Opinion: version 3 of the extension seems easier to use

Tested the json_last_error () PHP function to check for JSON errors and returned the JSON_ERROR_NONE constant.

The problem is that in the JSON text, the quotes you used are these ones “”, not the regular "". That’s why JSON is not valid and hence is not parsed.

Also, I suggest using our own JSON component in Utilities category.


Drag this image to copy blocks

3 Likes