Weird JSON

Get help using Construct 2

Post » Mon Aug 12, 2013 3:53 am

That is sent from a mobile application to my rails application:

{"c2array":true,"size":[3,3,1],"data":[[[0],[1],[2]],[[1],[2],[3]],[[2],[3],[4]]]}

But for some reason I'm getting the request like this:

{
"{\"c2array\":true,\"size\":"=>
{"3,3,1"=>
{",\"data\":"=>
{"0"=>
    {","=>
      {"1"=>
        {","=>
          {"2"=>
            {","=>
              {"1"=>
               {","=>
                  {"2"=>
                    {","=>
                      {"3"=>
                        {","=>
                          {"2"=>
                            {","=>
                             {"3"=>
                                {","=>{"4"=>{"}"=>nil}}}}}}}}}}}}}}}}}}}},

"action"=>"create",
"controller"=>"maps"
}

I need to save it in my database, but I honestly do not know why that json is deformed in this way or how I can treat it for what I need.

Note: Both params 'action' and 'controller' are part of my framework so the problem is just the way my json arrives.
aguzz2013-08-12 03:57:54
B
23
S
3
G
5
Posts: 10
Reputation: 4,302

Post » Mon Aug 12, 2013 4:15 am

I just realized that i'm receiving the json like this because is getting taken as the params name, if there is a way to include the ajax post's data into a variable name maybe that will solve my problem.

Is like i was sending

"{"c2array":true,"size":[3,3,1],"data":[[[0],[1],[2]],[[1],[2],[3]],[[2],[3],[4]]]}" => nothing

instead

"data" => {"c2array":true,"size":[3,3,1],"data":[[[0],[1],[2]],[[1],[2],[3]],[[2],[3],[4]]]}

You know what I mean?aguzz2013-08-12 04:17:34
B
23
S
3
G
5
Posts: 10
Reputation: 4,302


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 5 guests