3 ms·
Show HN: JSON-Form
json-form is a single html element that store HTML Input elements values in Object or Array. It can be nested in same way as Objects and Arrays allowing to output JSON of any complexity. It does not require framework or library. Thank you for checking it.
- fkekic 4y agotest.
- treve 4y agoGenerally like this idea. I've been working on something similar but with a slightly different angle: https://www.npmjs.com/package/html-form-enhancer https://www.npmjs.com/package/html-form-enhancer
- fkekic 4y agoHi, I could not check the code (teams restricted) but I agree that https://www.w3.org/TR/html-json-forms/ https://www.w3.org/TR/html-json-forms/ was the only decent proposal to resolve <form>-JSON. Initially, I wanted to use same approach but parsing strings for deeply nested structures was not elegant to say the least. I hope that in near future we will have something standardized. Cheers.
- yawnxyz 4y agothis is really clever! I've put something together like this but much heavier with Svelte. Love this approach!
- yawnxyz 4y agocould you create an example with dynamic children, e.g. in ACME booking (https://json-form.com/demos/demo-acme-booking.php https://json-form.com/demos/demo-acme-booking.php) there's a button to "add another child"? Does your platform support that use case?
- fkekic 4y agoHi, thank you for looking at json-form. Dynamically adding should work without problems. I will add the button and will let you know. Regards
- yawnxyz 4y agoamazing, thanks so much for sharing this! I combined this with a svelte thing I'm working on and it's working amazingly!! You've saved me a TON of work!
- fkekic 4y agoHi, I have added dynamic option. There's button "Add child". It works :) https://json-form.com/demos/demo-acme-booking-dynamic.php https://json-form.com/demos/demo-acme-booking-dynamic.php
- fkekic 4y agoRegarding Svelte: probably the best framework there is. I considered using it but it turned out to be too much for this requirement.