AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [JSON] Invalid JSON value! 1 (https://forums.alliedmods.net/showthread.php?t=335193)

karaulov 11-14-2021 06:15

[JSON] Invalid JSON value! 1
 
Code

Code:

new JSON: g_jObject = json_init_object();
json_object_set_value(g_jObject, "test", json_init_number(1), false);
json_free(g_jObject );

got error

L 11/14/2021 - 14:14:36: [JSON] Invalid JSON value! 1

How to fix ??(((

Installed latest master AMXMODX with modules and includes.

karaulov 11-14-2021 06:25

Re: [JSON] Invalid JSON value! 1
 
Same error with (no error but value not written)
Code:

new JSON:tmpObj  = json_init_object();
json_object_set_number(tmpObj,key,1);
new JSON: g_jObject = json_init_object();
json_object_set_value(g_jObject, "test", tmpObj, false);
json_free(g_jObject );
json_free(tmpObj );

but with less often

fysiks 11-14-2021 16:14

Re: [JSON] Invalid JSON value! 1
 
I've never used the JSON feature in AMX Mod X but maybe start with the json_test.sma plugin and make sure that that works and then base your code on that. This test plugin should in your files already in amxmodx/scripting/testsuite/json_test.sma.

GoodbayKOD 11-14-2021 23:34

Re: [JSON] Invalid JSON value! 1
 
in the last amx update, the native:
PHP Code:

json_object_set_value 

gives errors. It is a bug in the update.

fysiks 11-15-2021 22:06

Re: [JSON] Invalid JSON value! 1
 
Quote:

Originally Posted by GoodbayKOD (Post 2763470)
in the last amx update, the native:
PHP Code:

json_object_set_value 

gives errors. It is a bug in the update.

What are you referring to as "the last amx update"?

GoodbayKOD 11-16-2021 19:08

Re: [JSON] Invalid JSON value! 1
 
Quote:

Originally Posted by fysiks (Post 2763549)
What are you referring to as "the last amx update"?

https://github.com/alliedmodders/amx...02066eb32493de

fysiks 11-16-2021 21:03

Re: [JSON] Invalid JSON value! 1
 
Quote:

Originally Posted by GoodbayKOD (Post 2763628)

Just to clarify, is that the commit that broke it or the one that fixed it?

GoodbayKOD 11-16-2021 21:44

Re: [JSON] Invalid JSON value! 1
 
Quote:

Originally Posted by fysiks (Post 2763635)
Just to clarify, is that the commit that broke it or the one that fixed it?

if I'm not mistaken, that's exactly what happened.

fysiks 11-17-2021 00:04

Re: [JSON] Invalid JSON value! 1
 
Quote:

Originally Posted by GoodbayKOD (Post 2763637)
if I'm not mistaken, that's exactly what happened.

That's not an answer to my question.

GoodbayKOD 11-17-2021 05:20

Re: [JSON] Invalid JSON value! 1
 
Broke it...


All times are GMT -4. The time now is 20:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.