Weird JSON

0 favourites
  • 2 posts
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

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