我有一个JSON格式-
{ route: 'fullbody',
workout: [
[{exercise:'Squat', sets:'3', reps: '8-12'}, {exercise:'Row', sets:'3', reps: '8-12'}, {exercise:'Deadlift', sets:'3', reps: '8-12'}, {exercise:'Plank', sets:'3', reps: '8-12'}],
[{exercise:'OHP', sets:'3', reps: '8-12'}, {exercise:'Row', sets:'3', reps: '8-12'}, {exercise:'Deadlift', sets:'3', reps: '8-12'}, {exercise:'Plank', sets:'3', reps: '8-12'}]
],
title: 'Full Body Workout',
features: ['easy','3 times week','beginner'],
image: 'https://c8.alamy.com/comp/EDYW5M/portrait-of-a-bodybuilder-with-muscular-physique-posing-against-black-EDYW5M.jpg'
}
我已将它作为JSON.Stringify之后的查询参数传递给Dynamic Child Route。 (由于默认情况下数组未作为查询参数传递,因此已将其字符串化了)
像这样传递它-
<a class="btn waves-effect btn-elegant waves-light" [routerLink]="workoutObj.route" [queryParams]="workoutTableParam">Use Routine <i class="fa fa-angle-double-right"></i></a>
但是,在目标路由中检索executableTableParam时,我得到了以下形式的JSON:
如何将其解析回原始格式?