How to process the data received from API in ND-JSON format?
TIMAI2
November 24, 2023, 5:40pm
2
Strip the returned content of any \n
or \r\n
characters using text replacement blocks, and replace with a comma. You may also need to add square brackets [ ]
around the outside of your json.
ndjson
1 Like
when I do so I receive the output <!DOCTYPE
ABG
November 24, 2023, 8:37pm
4
That's usually an error message.
Show your response content before you try to process it.
1 Like
The response content is from ND-JSON streaming. Could be that the problem is because I am trying to display the response in Label1.Text?
Ria_Das
November 25, 2023, 8:29am
6
rayblanga:
The response content
Can you provide an example of the response you get ?
My blocks:
Here is the response I get in the app:
Here is the response I receive in the terminal:
TIMAI2
November 25, 2023, 9:15am
8
Just set the responseContent to your label, no processing
Is your token correct? Or you use xxxxxx as token in your blocks just for security?
Taifun
November 25, 2023, 11:51am
10
You most probably got an eror message in html format... therefore
Also do not initialize a global variable with some text from a textbox
Use Textbox1.Text directly in the url instead of that global variable
Taifun
ABG
November 25, 2023, 12:50pm
11
Your terminal response is just JSON.
No \n
1 Like
ABG
November 25, 2023, 12:57pm
12
When I heard the MIT default CloudDB instance was upgraded, I decided to use it to try out CloudDB's list value handling, and show off my Unicode chess button board.
My test environment for a multi-player multi-device session was MemuPlay's Multi-Memu emulator on Windows 7. I made two different emulators, and loaded built .apk files onto each, both running on my desktop. Here's my test session, recreating the shortest of all chess games, the Fool's Mate ...
[FoolsMate]
In Screen1, I choo…
If you want a chess board from buttons.
TIMAI2
November 25, 2023, 3:35pm
14
Are you going to show your raw responseContent, which will contain the error message ?
Now there is not response at all:
Taifun
November 25, 2023, 4:45pm
16
is there a space after Bearer
?
in case both the token and game id are correct, these blocks should work...
Taifun
There is a space between Bearer and the token. The token is correct.
I must to remark that I can receive correct response (JSON response) for another requests from the API. The problem is with ND-JSON response (streaming data)
The response is definitely ND-JSON format. In the uploaded picture of the terminal I show only begining of the streaming response.
Taifun
November 25, 2023, 7:08pm
19
try logcat to find out what is going on
ADB is a command-line utility that that can be used to control your device over USB from a computer. It will allow you to install / uninstall and or view logs on your device. This could be very handy when there are issues with a specific app and you like to view the logs for information that may lead to identify the cause of error.
In this post, we’ll discuss how to install and use ADB.
Installation:
ADB comes with Android SDK. However, you can download ONLY the ADB files from HERE . Download…
Taifun
ABG
November 25, 2023, 9:23pm
20
I received a list of JSON objects, joined by \n separators.
Splitting at \n gave me a list of JSON objects that look ready for the web block that decodes JSON as dictionaries.
2 Likes