hyperatom / json-form-data Goto Github PK
View Code? Open in Web Editor NEWA library to convert javascript objects into form data.
License: MIT License
A library to convert javascript objects into form data.
License: MIT License
Hello
This is awesome first off. I'm just stuck on nested Objects not getting appended. (Or at least they come back null.)
JSON example.
department: { main_image: { image: File, name: string, meta_tag: string }, title: string, subtitle: string, meta_tag: sring, meta_description: string, slug: string, published: boolean }
So when that is converted into FormData the main_image object is returned as null.
json-form-data works fine directly converting a main_image instance into formData but when the object is nested it returns null.
Thoughts?
Maybe I am approaching this wrong..
Nuxt.js is the Framework.
I noticed this project doesn't have TS type definitions, so I've opened a PR to add them at DefinitelyTyped (DefinitelyTyped/DefinitelyTyped#40606).
Feel free to request changes if anything looks off. Thanks for this project! ๐
It seems this option removes all array indexes, not only in leaf nodes. For example:
serialize({ array: [1, 2], nested: [{ key: 1 }, { key: 2 }]}, { showLeafArrayIndexes: false })
Generates:
array[]: 1
array[]: 2
nested[][key]: 1
nested[][key]: 2
But I would have expected:
array[]: 1
array[]: 2
nested[0][key]: 1
nested[1][key]: 2
API I'm working with accepts props in format like object.prop
instead of object[prop]
.
Good job guys, but if you add such feature it will make this lib even better.
Thank you!
$.jsonToFormData
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.