• How to Sanitize this JSON formatted Data(Quill Delta) ? Its a representation of a html code as JSON.

    {
        "content": {
            "type": "doc",
            "content": [
                {
                    "type": "paragraph",
                    "content": [
                        {
                            "type": "text",
                            "text": "Hello, "
                        }
                    ]
                },
                {
                    "type": "heading",
                    "attrs": {
                        "level": 1
                    },
                    "content": [
                        {
                            "type": "text",
                            "text": "This is Heading "
                        }
                    ]
                },
                {
                    "type": "paragraph",
                    "content": [
                        {
                            "type": "text",
                            "text": "This is a "
                        },
                        {
                            "type": "text",
                            "marks": [
                                {
                                    "type": "link",
                                    "attrs": {
                                        "href": "www.ads-software.com",
                                        "target": "_blank"
                                    }
                                }
                            ],
                            "text": "link"
                        }
                    ]
                }
            ]
        }
    }
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Different data types need different sanitation methods. Sanitizing an email address is different than sanitizing element attributes. You’d need to parse the JSON into an array structure, the walk the structure and sanitize each element based on its data type. Recursive functions are useful for this since they can handle nested arrays.

Viewing 1 replies (of 1 total)
  • The topic ‘How to Sanitize Quill Delta Code (Json)’ is closed to new replies.