views:

222

answers:

4

Hi,

I'm using text files in JSON format as input to my java/perl programs.

I would like to allow novice users to generate such JSON files themselves, following some template. Is there some GUI that allows easy, step-by-step creation of a JSON file?

It should allow filling in fields with text, choosing file locations etc. Also note the input format is not totally fixed - for example there are a couple of arrays where the number of elements can be chosen by the user, so the GUI should account for this flexibility too.

Thanks!

+1  A: 

I am not sure this one supports templates, but it is pretty feature rich:

http://www.thomasfrank.se/json_editor.html

I think the source code is available for it, so you can easily extend it to allow templates if needed. The "Template" stuff sounds like you want a "JSON DTD" - here's a neat proposal:

http://groups.google.com/group/json-schema/web/json-schema-proposal---second-draft

Another interesting JSON editor:

http://jsoneditor.appspot.com/

DVK
Thanks, some of these are interesting (I found many more editors in http://stackoverflow.com/questions/998832), but my main need is that JSON will be transparent to the user. I want some kind of a "form" that will convert the user input into JSON behind the scenes.
David B
I'm afraid it's DIY land for you, then... doesn't seem like TOO crazy of a project, though not 100% trivial :)Feel free to come back to SO with any questions resulting from it if you decide to DIY - I for one would be extra glad to help since I like the idea
DVK
Accepted. I guess there is currently no solution for this...
David B
+1  A: 

Generally when I want to create a JSON or YAML string, I start out by building the Perl data structure, and then running a simple conversion on it. You could put a UI in front of the Perl data structure generation, e.g. a web form.

Converting a structure to JSON is very straightforward:

use strict;
use warnings;
use JSON::Any;

my $data = { arbitrary structure in here };
my $json_handler = JSON::Any->new(utf8=>1);
my $json_string = $json_handler->objToJson($data);
Ether
Thanks, but I'm also unfamiliar with perl forms. Any recommendations for a simple form maker? It's really just a very small part of a project I'm working on so I don't like to spend too much time on building the form/UI instead of the real logic and algorithm I'm writing :)
David B
A: 

Hi David,

Thirst, thanks for using www.jsonpad.co.cc :)

Second, i'm realy not sure how you would have that form for filling in. Or what you understand under templates @ jsonpad.

But if you could explain me a bit better what you want, i could implement it into JSONpad. Please contact me again on my contact page at the link above, sry i did not got your mail, cause i made a very very stupid mistake in my contact form >.<

greetz, Chris

Chris
I've sent you an email
David B