tags:

views:

39

answers:

1

Forgive my second-rate google-fu, but I'm finding this topic tricky to search for. All I can find is crappy form-generators that will pump out HTML.

I'm looking for a library or established approach to store forms (fields rather than form data) in JSON format. Is there either a open-source form-builder that takes simple input and makes JSON / associative arrays to represent raw HTML form fields or something like a standard for doing so?

something like,

{
    "id": {
        "Input": ["select"],
        "Name": ["favorite_color"],
        "Options": ["red","green","blue"]
    }
}

etc...

I know this sounds like a trivial problem, but I'd like to at least peak at an accepted solution before just rolling my own.

A: 

That's basically a templating system, using JSON as its intermediate language. Is there any reason you want to use JSON rather than one of the kajillions of templating systems out there?

Marc B
I want to store user-generated forms in a databbase and use them in an existing application. It would make things delightfully simple to just plug this into a MySQL row as a chunk of JSON, but I'm open to alternatives.
Greg
A quick google found this: http://code.google.com/p/json-template/
Marc B