View Single Post
slekenda
Junior Member
Join Date: Aug 2017
Old 11-21-2018 , 02:31   Re: REST in Pawn - Communicate with JSON REST APIs
Reply With Quote #54

Hello!

I'm trying to load JSON from a file, but I'm getting an error. Anyone any help?

PHP Code:

    char path
[PLATFORM_MAX_PATH 1];
    
BuildPath(Path_SMpathsizeof(path), "data/match.json");
    
PrintToServer("FileExists %d"FileExists(path));

    
JSONObject data JSONObject.FromFile(path); 
Error:
PHP Code:
"[RIPEXT] Invalid JSON in line -1, column -1: unable to 
open addons/sourcemod/data/match.json: No such file or directory" 
PrintToServer("FileExists %d", FileExists(path)); <- This prints "FileExists: 1"

File:
PHP Code:
{
    
"map""de_dust2",
    
"uuid""awawras4aw4as4sa"

EDIT: Apparently when I add the absolute path of the JSON file to "JSONObject data = JSONObject.FromFile(path);" it works but not with the Path_SM

Last edited by slekenda; 11-21-2018 at 04:42.
slekenda is offline