PHP Classes

decode not working

Recommend this page to a friend!

      Fast JSON  >  All threads  >  decode not working  >  (Un) Subscribe thread alerts  
Subject:decode not working
Summary:I keep getting Error
Messages:4
Author:Mike
Date:2007-05-07 22:00:51
Update:2009-10-12 14:09:45
 

  1. decode not working   Reply   Report abuse  
Picture of Mike Mike - 2007-05-07 22:00:51
Undefined variable: resultFATAL: FastJSON decode method failure [malicious or incorrect JSON string]

Code :

include_once('lib/FastJSON.php');

$jsonEnc= new FastJSON();

//var_dump($_REQUEST);
//this works
$enVal=$jsonEnc->encode($_REQUEST);
var_dump($enVal);
// this gives error
$deVal=$jsonEnc->decode($enVal,false);
var_dump($deVal);

  2. Re: decode not working   Reply   Report abuse  
Picture of Igor Frias Vieira Igor Frias Vieira - 2008-12-10 19:40:46 - In reply to message 1 from Mike
Undefined variable: resultFATAL: FastJSON decode method failure [malicious or incorrect JSON string]


same problem...

my json string:
{"titulo" : "sdfsdf", "versao" : "", "materias" : [{"nome" : "Matéria", "perguntas" : [{"nome" : "Pergunta", "comentario" : "", "file_id" : "0_0", "respostas" : [{"nome" : "Resposta", "correta" : "1"}, {"nome" : "Resposta", "correta" : "0"} ]} ]} ]}

  3. Re: decode not working   Reply   Report abuse  
Picture of Oleg Oleg - 2009-02-05 09:42:53 - In reply to message 1 from Mike
Solution.

Go to
function "__decode" -> operatar "switch" -> "case '{'" -> "while".

In this "while" replace
"$tmp = FastJSON::__decodeString($encode, $pos);"
to
"$tmp = FastJSON::__decode($encode, $pos, $slen, $stdClass);".


P.S.: It helps me, i hope u too :)


  4. Re: decode not working   Reply   Report abuse  
Picture of boppy boppy - 2009-10-12 14:09:45 - In reply to message 3 from Oleg
oleg, ymmd! ;)