0

I tried to save my html contents as json formatting...

http://jsfiddle.net/UserNaN/2gWmP/

When clicking on the #save button, the html contents will be posted and will storing to json by PHP.

[{
    "container": [
        {
            "type": "title",
            "data": 1,
            "active": true,
            "content": "Content 1",
            "description": "Description 1",
            "main": [
                {
                    "type": "sub",
                    "content": "Content 2",
                    "description": "Description 2"
                },
                {
                    "type": "sub",
                    "content": "Content 3",
                    "description": null
                },
                {
                    "type": "title",
                    "data": 2,
                    "active": false,
                    "content": "Content 4",
                    "description": null,
                    "main": [
                        {
                            "type": "sub",
                            "content": "Content 5",
                            "description": "Description 5"
                        },
                        {
                            "type": "sub",
                            "content": "Content 6",
                            "description": "Description 6"
                        },
                        {
                            "type": "title",
                            "data": 3,
                            "active": true,
                            "content": "Content 7",
                            "description": null,
                            "main": [
                                {
                                    "type": "sub",
                                    "content": "Content 8",
                                    "description": null
                                },
                                {
                                    "type": "sub",
                                    "content": "Content 9",
                                    "description": null
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "type": "sub",
            "content": "Content 10",
            "description": "Description 10"
        },
        {
            "type": "title",
            "data": 4,
            "active": false,
            "content": "Content 11",
            "description": null,
            "main": [
                {
                    "type": "title",
                    "data": 5,
                    "active": false,
                    "content": "Content 12",
                    "description": null,
                    "main": [
                        {
                            "type": "sub",
                            "content": "Content 13",
                            "description": "Description 13"
                        }
                    ]
                },
                {
                    "type": "sub",
                    "content": "Content 14",
                    "description": null
                }
            ]
        }
    ]
}]

I do not know how to coding php to solve this problem.

If you just take a look at my problem and share a bit of your science, I'd be very grateful. Thanks!

UserNaN
  • 137
  • 2
  • 13

0 Answers0