I've recently had cause to back off from a couple of unrelated frameworks and start from scratch. In the one case, **Javascript** driven form UI and in the other the same for **Java Swing**. I realized I can make a simple **JSON** object defining my UI elements from fields to event bindings. 

Before I go too terribly far down the rabbit hole, I started wondering: **is there an emerging or existing standard** anyone has seen for this sort of thing? 

Below is one flavor of what I was kicking around. I'm playing with using a JSON object to define a Swing UI layout as well as (separately) web facing JavaScript generated web forms.

The two variable stem from my build up which was initially a simple grid control where I needed fields before I thought it would be good to have a form too. It could be folded into one JSON structure, of course. 

```
var app = {
        forms: form1,
        bindings: [],
        layout:[{
            width: 400,
            height: 300,
            bgcolor: '#fefefe',
            color: 'black'
        }]
    }

    var form1 = {
        "formfield1": {
            itype: "text",
            tag: "input",
            iclass: "frminput",
            defaultval: "text input",
            label: "Text Value 1",
            validation: '/[a-z][A-Z][0-9]/',
            error: "No special characters allowed - only numbers or letters for this input",
            bindings: [{
                ievent: 'click',
                fx: function(){
                    validateTest(this);
                }
            },{
                ievent: 'blur',
                fx: function(){
                    blurTest(this);
                }
            }]
        },

        "formfield2": {
            itype: "select",
            tag: "select",
            iclass: "frminput",
            defaultval: "apples",
            label: "Test Select",
            options: [["apples","Apples"], ["oranges","Oranges"], ["peaches","Peaches"]]
        },

        "formfield3": {
            itype: "date",
            tag: "input",
            iclass: "date",
            label: "Test Date",
            defaultval: new Date()
        },

        "formfield4": {
            itype: "text",
            tag: "input",
            iclass: "frminput",
            label: "Text field 2",
            defaultval: "text input other"
        },

        "objectproperty": {
            itype: "button",
            tag: "button",
            iclass: "btn btn-small",
            label: "test magnitude button",
            defaultval: "",
            bindings: [{
                ievent: 'click',
                fx: function(){
                    buttonAction(this);
                }
            }]
        }
    };

```

What I would most like to find is that someone else has put more thought into this already. 

Second best result of this post would be some suggestions for what would be a best practice. 

The goal is to have a fairly agnostic implementation that is portable to other platforms in the future or provides easy integration of disparate systems.

**Update**: Good discussion in this question: [Standard JSON API response format?](https://stackoverflow.com/questions/12806386/standard-json-api-response-format) regarding emerging and suggested standards for various JSON based objects and implementations. Most of this focuses on AJAX usage however. Still a good cross-reference from this question.