Search code examples
jsonangulartypescriptsignalrkeyvaluepair

Large Nested JSON DICT SignalR dictonairy to Typescript


Im new to angular/Typescript, to learn typescript i have followed an

Class Data: 
DictKey = DictKey

// multiple use of the key value of the dict...
DictKey = Key 

Class Key: 

key1 = key1

key2 = key2

The message is as follows with a lot of more dictkeys:

{"DATA1DICT1":{
    "Dictkey1": {
        "Key1": 1,
        "Key2": 1,
        "Key3": {
            "Key3.1": 1,
            "Key3.2": 1
        },
        "Key4": 1,
        "Key5": "2020-05-18"
    },
    "DictKey2": {
        "Key1": 1,
        "Key2": 1,
        "Key3": {
            "Key3.1": 1,
            "key3.2": 1
        },
        "Key4": 1,
        "key5": "2020-05-18"
    }
},
"DATA1DICT2":{
    "AnotherKey": 1,
    "AnotherKey": 1,
    "AnotherKey": 1,
    "KeyDict3": {
        "Key3.1": 1,
        "Key3.2": 1
    },
    "KeyDict4": {
        "Key4.1": 1,
        "Key4.2": 1
    }
}
}

the message above is one message with above defined key value/dynamic structure as result


Solution

  • not so existing: just json(parse) and build your nested objects like in c#