Jump to content

JSON encode backslashes problem


Recommended Posts

You can see my script to POST json and the problem where occurs backslashes before quotations. Second problem is the apperance , there is no new lines for every new value.

LOOK in attached images!

 

You can see rest api on the screen and with id = 0 its made my postman and the rest by autoit (with backslashes)

 

Func jsonSave()
    ; Make login request to server JSON POST
    Local $data, $request
    Local $obj
    Local $adress = 'http://35.195.249.40:3004/msg'

    
    Json_Put($Obj, ".msgName", "Point HPs")
    Json_Put($Obj, ".msg", "Not pointed correctly")
    Json_Put($Obj, ".username", "karolek890")
    Local $Json = Json_Encode($Obj,$JSON_UNESCAPED_SLASHES) ; WITHOUT preetier becouse it makes clashes r n and t only works in autoit


    $request = _httpRequestBot($adress, 'POST', $Json) ; only get login if correct then success

    If @error Then
        Exit MsgBox(0, "Error", "Open method returned @error = " & @error & " and @extended = " & @extended)
    Else
        ConsoleWrite("Data to json server posted!")
    EndIf


EndFunc

 

Im using this JSON UDF

 

 

 

Capture_077.jpg

Capture_075.jpg

Edited by Miliardsto
Link to comment
Share on other sites

  • Developers

Do you seriously think it helps when you post your problem in 3 places? I for one immediately lose the urge to assist. 
Either way: Please don't post questions in multiple threads/forums !

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Post all needed elements as text as none of what you have posted is runnable and will demonstrate your problem.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...