'cURL doesn't print whole JSON output

i'm trying to build some script that i will need to check json via curl and print the output, but somehow it's not working. My other API JSON are working fine using this script

Script :

    #!/bin/bash

OUT=$(curl -X POST -s -w "|%{time_total}|%{http_code}"\
    -H "Content-Type: application/json" \
    --ciphers 'AES256-GCM-SHA384' \
  -d '{
    "Username": "van_user1test",
    "Password" : "123MM4566"}' \
        https://127.0.0.1/api/call/login)

echo "THIS IS MASTER OUT" $OUT

out2="$(echo $OUT | cut -d\| -f 1)" 
out_response="$(echo ${OUT} | cut -d\| -f 2)"
out_httpcode="$(echo ${OUT} | cut -d\| -f 3)" 

echo "This is out2" $out2
echo "this is response" $out_response
echo "this is httpcode" $out_httpcode

And i'm getting as result :

 }|0.437357|200ccess at 07/03/2022 11:23:11"
 }Message": "Success at 07/03/2022 11:23:11"

this is response 0.437357
this is httpcode 200

But when i run curl command(above) manually, i get fine response :

{
  "Successmessage": true,
  "Message_status": "Success at 07/03/2022 11:27:28"
}|0.483469|200

I guess the problem can be in the tags somewhere because the first line SUccessmessage is missing and i'm worried why, also the format is not displayed correctly

I want to get fully response from json output and printing all the lines

Update : HOW to display in one line the latest result ?

{
  "Successmessage": true,
  "Message_status": "Success at 07/03/2022 11:27:28"
}|0.483469|200

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source