Merging:Şöyle bir JSON şemasından JavaScript dinamik yapılı bir form ile çalışıyorum iç içe iki JSON diziler
formu sadece şuna benzer güncellenmiş değerleri döndürür gönderilirse{
"questionSets": [
{
"questionSetId": "example-fields",
"questions": [
{
"questionId": "text",
"question": "Text Field",
"input": {
"type": "textInput",
"default": ""
},
},
{
"questionId": "textarea",
"question": "Text Area",
"input": {
"type": "textareaInput",
"default": ""
}
}
]
}
]
}
Bu elde edilen JSON dizinin
{
text: "some entered text",
textarea: "some more entered text"
}
anahtarlar QuestionID ve birinci dizideki varsayılan anahtarla değeri karşılık gelir. ilginç bir olay var
{
"questionSets": [
{
"questionSetId": "example-fields",
"questions": [
{
"questionId": "text",
"question": "Text Field",
"input": {
"type": "textInput",
"default": "some entered text"
},
},
{
"questionId": "textarea",
"question": "Text Area",
"input": {
"type": "textareaInput",
"default": "some more entered text"
}
}
]
}
]
}
filter gibi yeni Dizi prototip fonksiyonları vasıtasıyla aynı elde etmek mümkündür boş bir dizi ve sonuçların üzerinden yineleyin ve buna göre boş diziye ekleyin? – argon