'Normalizing a nested Json structure
I have a rather complicated dataset that I wish to normalize with the normalizr library.
Here is the interface for my data set and child type definitions
type Variant {
variantId: string;
variantName: string;
.....
}
interface IFrequencies {
frequency: ScheduleFrequency;
recurrence?: number;
offsetLastDate?: string;
}
interface ISchedulerConfig {
orderOfJobs: string[],
frequencies: IFrequencies[]
}
interface ExperimentList {
experimentId: string;
/*
some properties
*/
variantList: Variant[]
schedulerConfig: ISchedulerConfig[]
}
With a data set of ExperimentList[]. I want to get an end-state of an array of ResultIWant:
interface ResultIWant{
experimentId: string;
variantId: string;
job: {
orderOfJobs: string[],
frequency: IFrequencies
}
}
Any ideas on how to do so? I've tried playing with normalizr for a long time, and can't seem to get anywhere.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
