Unable to make a json of jquery drag and drop

Ok sir Paul_Wilkins I am working on My json

If it’s of any help - I think that the resulting JSON code that you will be wanting, may be something like the following:

{
  "data":{
    "numbers":[
      "+6589745258"
    ],
    "flow":{
      "data":{
        "id":"263c679f558dea68d57855f3f57cccee",
        "timeout":"20",
        "can_call_self":false
      },
      "module":"user",
      "children":[
        "menu",
        "podcast",
        "menu",
        "music"
      ]
    }
  },
  "verb":"PUT"
}

Is this, with that children array defining the order of the items, what you will be wanting?

Sir Paul_Wilkins i design json but got some problem fiddle

What problem are you having?

Thanks for your respone sir actually now i want to make my json as child parent node, In my fiddle , [fiddle][1] on first drop i make my json but on second time when you drop any module i want to push or append the whole json in children on first drop
I want to make dynamic JSON sir
[1]: http://jsfiddle.net/3d6fbLbe/10/

I still don’t see the problem.

I put down a Menu for example, followed by a nested device:

  1. Menu
    1. device

and things seem to work well.

I paste the resulting JSON code in to a JSON formatter and the device is definitely nested inside of the menu.

Can you please supply further details to help me experience the problem that you are experiencing.

Hello Paul_Wilkins
Sir no problem with that
1. Menu
1. user
It’s work great user can drop anything like

  1. Menu
    1. device
      but i have to make it dynamic so when user can drop anything json is dynamically build

like for this situation
1. Menu
1. user
1.device
1.Menu
i have to make dynamic json
somethin like in this fiddle fiddle it’s create dynamic json same i want

I’m sorry but I still don’t understand what you’re wanting to achieve, and also at this stage has me questioning my intelligence too.

Sir Paul_Wilkins I want to achieve dynamic json and nothing.

First of all see my fiddle sir you see some json like for menuJson on line number 2, UserJson on line number 10. I want when user(or visitor) drop any module i want to build json as per as user drop.

  1. Imagine that user drop anything like Menu then i call the menuJson then second time user drop device or anything then i call the device json and append or push the Device json into Menu json that is first dropped because MenuJson is parent may be on second time user can drop user module instead of Device as per as i have to append or push the userJson to Menujson children then third time user drop menu i want to append or push the whole json of menu to device children

User Drop Menu (Parent)
the you drop Device on Menu Device (Device stored on Menu children)
then you drop Menu on User Menu (Menu stored on device children)
then you drop on User on Menu User (User stored on Menu children)

Then Menu is parent
One thing user can drop anything as per as requirement

Something like that fiddle

Hey Paul

I have created AngularJS based drag and drop UI with the using Jquery.
There are modules which are draggable and droppable. I have made
these modules draggable and droppable but, I have to make some JSON
for every module after dropping that. There are modules like Menu,
User, Device and so on. When I will drag a Menu and drag further
module under the Menu module that will be drag as per user sequence
like on “1” drag device module, on “2” drag
user module and so on, but there is default action as well and on
that sequence “_” this should be put in the JSON. All the
modules which will drag under the Menu module these all should be
children of Menu or you can say that these all should be under the
Menu module. And the complete JOSN should be like as below:

{“flow”:{“data”:{“id”:“30b5c624784400145d1abe0c3592d6db”},“module”:“menu”,
“children”:{“1”:{“data”:{“id”:“27a61a8272e4afa182040ea8c464455b”},“module”:
“device”,“children”:{}},“2”:{“data”:{“id”:“d2e837eac2c5f5036673845c08b572b6”},
“module”:“user”,“children”:{}},“3”:{“data”:{“id”:“27d77b6b5b544115a562709820234efe”},
“module”:“device”,“children”:{}},“5”:{“data”:{“id”:“4d02e2aaec1968b35e1a4cd245419e97”,
“timeout”:“20”,“can_call_self”:false},“module”:“user”,“children”:{}},“_”:
{“data”:{“id”:“052803186d73c0723a64f065a1ddc19a”,“timeout”:“20”,
“can_call_self”:false},“module”:“device”,“children”:{}}}}}

The other module is single inheritance module that will be not
multiple droppable only the Menu module is multiple droppable.
I have created a fiddle but getting no success, here is the fiddle

Hey i write some code for making json but bit confuse i take
three variables for json for menu, user, device. while drop i can
identify the drop module with the help of -----> var foo = $(ui.draggable).text(); if (foo.match(“user”)) {
console.log(userJson.data.id = “person”); console.log(userJson.key = “_”);

So on first time i can identify the module and add the JSON but on
second time i can drop anything like menu, user, device. so how can i
append on children dynamically fiddle

Hi! I’d like to help but I don’t understand what you’re trying to do. Can you explain this another way?

Hey OzRamos, thanks for your reply

I have created AngularJS based drag and drop UI with the using Jquery. There are modules which are draggable and droppable. I have made these modules draggable and droppable but, I have to make some JSON for every module after dropping that. There are modules like Menu, User, Device and so on. When I will drag a Menu and drag further module under the Menu module that will be drag as per user sequence like on “1” drag device module, on “2” drag user module and so on, but there is default action as well and on that sequence “_” this should be put in the JSON. All the modules which will drag under the Menu module these all should be children of Menu or you can say that these all should be under the Menu module. And the complete JOSN should be like as below:

{"flow":{"data":{"id":"30b5c624784400145d1abe0c3592d6db"},"module":"menu","children":{"1":{"data":{"id":"27a61a8272e4afa182040ea8c464455b"},"module":"device","children":{}},"2":{"data":{"id":"d2e837eac2c5f5036673845c08b572b6"},"module":"user","children":{}},"3":{"data":{"id":"27d77b6b5b544115a562709820234efe"},"module":"device","children":{}},"5":{"data":{"id":"4d02e2aaec1968b35e1a4cd245419e97","timeout":"20","can_call_self":false},"module":"user","children":{}},"_":{"data":{"id":"052803186d73c0723a64f065a1ddc19a","timeout":"20","can_call_self":false},"module":"device","children":{}}}}}

The other module is single inheritance module that will be not multiple droppable only the Menu module is multiple droppable.

I have created a fiddle but getting no success, here is the fiddle

What happen Paul_Wilkins not reply yet but i have something for making json see this fiddle
but what i need in this format.
{“flow”:{“data”:{“id”:“d2e837eac2c5f5036673845c08b572b6”},“module”:“conference”,“children”:{““:{“data”:{“id”:“4d02e2aaec1968b35e1a4cd245419e97”,“timeout”:“20”,“can_call_self”:false},“module”:“user”,“children”:{””:{“data”:{“id”:“4d02e2aaec1968b35e1a4cd245419e97”,“timeout”:“20”,“can_call_self”:false},“module”:“user”,“children”:{}}}}}}}

Sorry @sunny_negi but it seems that I’m unable to get my head around your problem.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.