Godot Version
v3.5.3(Linux)
Question
How can I print() “TEST”?
ERROR: Error parsing JSON at line 1: Expected key index.js:369:18
at: parse (core/bind/core_bind.cpp:3267) - Error parsing JSON at line 1: Expected key index.js:369:18
extends Node
var my_http_request := HTTPRequest.new()
func _ready():
add_child(my_http_request)
my_http_request.connect("request_completed", self, "_my_http_request_completed")
_my_http_request()
func _my_http_request():
var my_error = my_http_request.request(Setting.gameUrl + "/test.json")
if my_error != OK:
push_error("HTTPリクエスト中にエラーが発生しました。")
func _my_http_request_completed(my_result, my_response_code, my_headers, my_body):
var my_response = JSON.parse(my_body.get_string_from_utf8())
print("my_result: " + str(my_result))
print("my_response_code: " + str(my_response_code))
print("my_headers: " + str(my_headers))
print("my_body: " + str(my_body))
print("my_response: " + str(my_response))
test.json
{
{"foo":1,"bar":"TEST"},
}