JSON to Dictionary

0 favourites
  • 4 posts
  • AJAX.lastData = { "asd" : "123" }

    For the love of god do I not find a way to get that into a dictionary.

    Please help. Thank you

  • Here my php in case that helps.


    // try to return json

    header('Content-type: application/json');

    $json = array( "asd" => "123" );

    echo json_encode($json);

    //return json_encode($json);


  • Ok so this works

    echo '{"c2dictionary":true,"data":{"asd":"123"}}';

    I see. So then how do I get a normal json response {"asd":"123"} into this format? (without rewriting it in php of course)

    There must be something I am missing here.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Search for forums would also be great, or not every single post that looks promising ending on a 404.

    Here the hack for delivering a correct json (again, this does not answer my question, I don't want to modify my php, there must be a way in construct 3 to deal with it)

    <?php header('Content-type: application/json'); $json = array(); $json['c2dictionary'] = true; $json['data']['asd'] = '123'; echo json_encode($json); ?>

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)