Parse text with multiple strings in brackets into arrays
I have a problem with parsing something like this:
{form_settings['settings']['title']: "Titulek", form_settings['settings']['description']: "Popisek formuláře...", form_settings['settings']['gdpr']: "ip", form_settings['settings']['acquisition']: "n", form_settings['settings']['style_form']: "without_border", …}
I want something like in the PHP, where you can call this
$form_settings['settings']['title']
But you can't do it in javascript and i want to use similiar array like in the php I want to do something like that
form_settings['settings']['title']
Because it doesn't work, do you know how to parse it? Thanks for the answers!
//EDIT
<div class="col-md-10 col-form-label">
<input type="text" id="title-for-receiver" class="form-control" name="form_settings['email']['{$input_form['EMAIL']['title_for_receiver']->name}']" value={$input_form['EMAIL']['title_for_receiver']->value} />
</div>
And I got these values through javascript
function getFormData(form){
var unindexed_array = form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function(n, i){
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
javascript jquery arrays json parsing
|
show 7 more comments
I have a problem with parsing something like this:
{form_settings['settings']['title']: "Titulek", form_settings['settings']['description']: "Popisek formuláře...", form_settings['settings']['gdpr']: "ip", form_settings['settings']['acquisition']: "n", form_settings['settings']['style_form']: "without_border", …}
I want something like in the PHP, where you can call this
$form_settings['settings']['title']
But you can't do it in javascript and i want to use similiar array like in the php I want to do something like that
form_settings['settings']['title']
Because it doesn't work, do you know how to parse it? Thanks for the answers!
//EDIT
<div class="col-md-10 col-form-label">
<input type="text" id="title-for-receiver" class="form-control" name="form_settings['email']['{$input_form['EMAIL']['title_for_receiver']->name}']" value={$input_form['EMAIL']['title_for_receiver']->value} />
</div>
And I got these values through javascript
function getFormData(form){
var unindexed_array = form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function(n, i){
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
javascript jquery arrays json parsing
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
1
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
If you doform_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)
– isherwood
Nov 21 '18 at 21:00
|
show 7 more comments
I have a problem with parsing something like this:
{form_settings['settings']['title']: "Titulek", form_settings['settings']['description']: "Popisek formuláře...", form_settings['settings']['gdpr']: "ip", form_settings['settings']['acquisition']: "n", form_settings['settings']['style_form']: "without_border", …}
I want something like in the PHP, where you can call this
$form_settings['settings']['title']
But you can't do it in javascript and i want to use similiar array like in the php I want to do something like that
form_settings['settings']['title']
Because it doesn't work, do you know how to parse it? Thanks for the answers!
//EDIT
<div class="col-md-10 col-form-label">
<input type="text" id="title-for-receiver" class="form-control" name="form_settings['email']['{$input_form['EMAIL']['title_for_receiver']->name}']" value={$input_form['EMAIL']['title_for_receiver']->value} />
</div>
And I got these values through javascript
function getFormData(form){
var unindexed_array = form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function(n, i){
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
javascript jquery arrays json parsing
I have a problem with parsing something like this:
{form_settings['settings']['title']: "Titulek", form_settings['settings']['description']: "Popisek formuláře...", form_settings['settings']['gdpr']: "ip", form_settings['settings']['acquisition']: "n", form_settings['settings']['style_form']: "without_border", …}
I want something like in the PHP, where you can call this
$form_settings['settings']['title']
But you can't do it in javascript and i want to use similiar array like in the php I want to do something like that
form_settings['settings']['title']
Because it doesn't work, do you know how to parse it? Thanks for the answers!
//EDIT
<div class="col-md-10 col-form-label">
<input type="text" id="title-for-receiver" class="form-control" name="form_settings['email']['{$input_form['EMAIL']['title_for_receiver']->name}']" value={$input_form['EMAIL']['title_for_receiver']->value} />
</div>
And I got these values through javascript
function getFormData(form){
var unindexed_array = form.serializeArray();
var indexed_array = {};
$.map(unindexed_array, function(n, i){
indexed_array[n['name']] = n['value'];
});
return indexed_array;
}
javascript jquery arrays json parsing
javascript jquery arrays json parsing
edited Nov 21 '18 at 21:04
Miškyns
asked Nov 21 '18 at 20:54
MiškynsMiškyns
62
62
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
1
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
If you doform_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)
– isherwood
Nov 21 '18 at 21:00
|
show 7 more comments
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
1
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
If you doform_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)
– isherwood
Nov 21 '18 at 21:00
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
1
1
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
If you do
form_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)– isherwood
Nov 21 '18 at 21:00
If you do
form_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)– isherwood
Nov 21 '18 at 21:00
|
show 7 more comments
1 Answer
1
active
oldest
votes
This is not something you can parse. That "parse" indicates a string or something that can be. THIS: cannot be "parsed":
- It has both single
'
and double"
quotes so NEITHER will work to make it a string which is a parse-able object. - It has internal elements with no quotes also
{form_settings['settings']['title']: "Titulek",
form_settings['settings']['description']: "Popisek formuláře...",
form_settings['settings']['gdpr']: "ip",
form_settings['settings']['acquisition']: "n",
form_settings['settings']['style_form']: "without_border", …}
EDIT: I added mythingString
and the parse of that to be more patently obvious.
Perhaps pass a better object:
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first getmything
you do not have that. That is the point.
– Mark Schultheiss
Nov 22 '18 at 16:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420323%2fparse-text-with-multiple-strings-in-brackets-into-arrays%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is not something you can parse. That "parse" indicates a string or something that can be. THIS: cannot be "parsed":
- It has both single
'
and double"
quotes so NEITHER will work to make it a string which is a parse-able object. - It has internal elements with no quotes also
{form_settings['settings']['title']: "Titulek",
form_settings['settings']['description']: "Popisek formuláře...",
form_settings['settings']['gdpr']: "ip",
form_settings['settings']['acquisition']: "n",
form_settings['settings']['style_form']: "without_border", …}
EDIT: I added mythingString
and the parse of that to be more patently obvious.
Perhaps pass a better object:
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first getmything
you do not have that. That is the point.
– Mark Schultheiss
Nov 22 '18 at 16:02
add a comment |
This is not something you can parse. That "parse" indicates a string or something that can be. THIS: cannot be "parsed":
- It has both single
'
and double"
quotes so NEITHER will work to make it a string which is a parse-able object. - It has internal elements with no quotes also
{form_settings['settings']['title']: "Titulek",
form_settings['settings']['description']: "Popisek formuláře...",
form_settings['settings']['gdpr']: "ip",
form_settings['settings']['acquisition']: "n",
form_settings['settings']['style_form']: "without_border", …}
EDIT: I added mythingString
and the parse of that to be more patently obvious.
Perhaps pass a better object:
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first getmything
you do not have that. That is the point.
– Mark Schultheiss
Nov 22 '18 at 16:02
add a comment |
This is not something you can parse. That "parse" indicates a string or something that can be. THIS: cannot be "parsed":
- It has both single
'
and double"
quotes so NEITHER will work to make it a string which is a parse-able object. - It has internal elements with no quotes also
{form_settings['settings']['title']: "Titulek",
form_settings['settings']['description']: "Popisek formuláře...",
form_settings['settings']['gdpr']: "ip",
form_settings['settings']['acquisition']: "n",
form_settings['settings']['style_form']: "without_border", …}
EDIT: I added mythingString
and the parse of that to be more patently obvious.
Perhaps pass a better object:
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
This is not something you can parse. That "parse" indicates a string or something that can be. THIS: cannot be "parsed":
- It has both single
'
and double"
quotes so NEITHER will work to make it a string which is a parse-able object. - It has internal elements with no quotes also
{form_settings['settings']['title']: "Titulek",
form_settings['settings']['description']: "Popisek formuláře...",
form_settings['settings']['gdpr']: "ip",
form_settings['settings']['acquisition']: "n",
form_settings['settings']['style_form']: "without_border", …}
EDIT: I added mythingString
and the parse of that to be more patently obvious.
Perhaps pass a better object:
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
var mything = {
"form_settings['settings']['title']": "Titulek",
"form_settings['settings']['description']": "Popisek formuláře...",
"form_settings['settings']['gdpr']": "ip",
"form_settings['settings']['acquisition']": "n",
"form_settings['settings']['style_form']": "without_border"
};
console.log(mything["form_settings['settings']['title']"]);
var mything2 = {
form_settings: {
settings: {
'title': "Titulek",
'description': "Popisek formuláře...",
'gdpr': "ip",
'acquisition': "n",
'style_form': "without_border"
}
}
};
console.log(mything2.form_settings['settings']['title']);
console.log(mything2.form_settings.settings.title);
var mythingString = '{"form_settings[settings][title]": "Titulek", "form_settings[settings][description]": "Popisek formuláře...", "form_settings[settings][gdpr]": "ip", "form_settings[settings][acquisition]": "n", "form_settings[settings][style_form]": "without_border"}';
var parsedThing = JSON.parse(mythingString);
console.log(parsedThing["form_settings[settings][title]"]);
edited Nov 22 '18 at 16:08
answered Nov 22 '18 at 0:34
Mark SchultheissMark Schultheiss
24.2k85181
24.2k85181
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first getmything
you do not have that. That is the point.
– Mark Schultheiss
Nov 22 '18 at 16:02
add a comment |
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first getmything
you do not have that. That is the point.
– Mark Schultheiss
Nov 22 '18 at 16:02
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
Yes that is the thing I want to do from the first "mything" to "mything2", I want to get it from HTML "name" and inside the elements mything2.form_settings['settings']['title'] would be value with title. How can I do that?
– Miškyns
Nov 22 '18 at 6:04
@Miškyns So, first get
mything
you do not have that. That is the point.– Mark Schultheiss
Nov 22 '18 at 16:02
@Miškyns So, first get
mything
you do not have that. That is the point.– Mark Schultheiss
Nov 22 '18 at 16:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420323%2fparse-text-with-multiple-strings-in-brackets-into-arrays%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you asking about parsing strings or targeting nested arrays? That doesn't look like valid JavaScript syntax, so I'm not sure what you're after.
– isherwood
Nov 21 '18 at 20:55
1
I mean, that's not valid JSON. Why not make it valid JSON?
– Taplar
Nov 21 '18 at 20:57
Yeah I want to parse it and save those strings in brackets to the arrays, which are named like the first string in bracket. So if you do something like tihs: form_settings['settings']['title'] you will get a Titulek string.
– Miškyns
Nov 21 '18 at 20:58
I've got them from html, because I have a name="form_settings['settings']['title']" and I got it by javascript I have more of these names on the same page, but there are different second bracket names. And I want to do it like in PHP.
– Miškyns
Nov 21 '18 at 21:00
If you do
form_settings['settings']['title']
in JavaScript you'll get only the title string. (I had to look up "titulek".)– isherwood
Nov 21 '18 at 21:00