We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When you have a input name like foo[8.8.8.8] serialising the form data into JSON creates:
foo[8.8.8.8]
{ "foo": {"8": {"8": {"8": {"8": "VALUE"}}}} }``` Rather than the expected: ```json { "foo": {"8.8.8.8": "VALUE"} }```
The text was updated successfully, but these errors were encountered:
Could be solved by using escape character \.:
\.
convertTo: function (name) { return name.replace(/\./g, '\\.').replace(/\[]/g, '.*').replace(/\[([^\]]+)]/g, '.$1'); }, set: function (object, key, value) { if (null === key) { return object = value; } var rev = key.split('').reverse().join(''); var keys = rev.split(/\.(?=[^\\])/g).reverse().map(function (x) { return x.split('').reverse().join(''); }); // var keys = key.split('.'); var temp = object; for (var k=0; k<keys.length-1; k++) { key = keys[k].replace(/\\\./g, '.'); if (key === '*') { key = Object.keys(temp).length; } if (typeof temp[key] === 'undefined') { temp[key] = {}; } temp = temp[key]; } key = keys[k].replace(/\\\./g, '.'); if (key === '*') { key = Object.keys(temp).length; } temp[key] = value; return object; }
Sorry, something went wrong.
No branches or pull requests
When you have a input name like
foo[8.8.8.8]
serialising the form data into JSON creates:The text was updated successfully, but these errors were encountered: