Skip to content
New issue

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

question, result.data is key value, converting to json #12

Open
iamfariba opened this issue May 14, 2019 · 1 comment
Open

question, result.data is key value, converting to json #12

iamfariba opened this issue May 14, 2019 · 1 comment
Labels
question Further information is requested

Comments

@iamfariba
Copy link

Hi,¨
in app.component.ts, in this method result.data has key value format,
surveyModel.onComplete
.add(result =>
this.submitSurvey.emit(result.data)
)
like {"question1":100,"myquestion2":"Yes"}, how can i have it like this json format:
{{
name:question1.
value: 100
},
{
name: myquestion1
value: yes
}
}

@tsv2013 tsv2013 added the question Further information is requested label May 15, 2019
@tsv2013
Copy link
Member

tsv2013 commented May 15, 2019

var newResult = Object.keys(result.data).map(function(qName) {
    return { name: qName, value: result.data[qName]};
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants