Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions powershell/llcsharp/model/model-class-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { popTempVar, pushTempVar } from '../schema/primitive';

import { ModelProperty } from './property';
import { ObjectImplementation } from '../schema/object';
import { NewModelInterface } from './interface';

export class JsonSerializableClass extends Class {
private btj!: Method;
Expand Down Expand Up @@ -299,8 +300,9 @@ export class NewJsonSerializableClass extends Class {
// wildcard style
deserializeStatements.push(new Statements(`${ClientRuntime.JsonSerializable}.FromJson( json, ${ap}, ${ClientRuntime.JsonSerializable}.DeserializeDictionary(()=>${System.Collections.Generic.Dictionary(System.String, System.Object).new()}),${exclusions.value} );`));

} else if (vType instanceof ObjectImplementation) {
deserializeStatements.push(new Statements(`${ClientRuntime.JsonSerializable}.FromJson( json, ${ap}, (j) => ${this.modelClass.fullName}.FromJson(j) ,${exclusions.value} );`));
} else if (vType instanceof NewModelInterface) {
// use the class of the dictionary value to deserialize values
deserializeStatements.push(new Statements(`${ClientRuntime.JsonSerializable}.FromJson( json, ${ap}, (j) => ${vType.classImplementation.fullName}.FromJson(j) ,${exclusions.value} );`));
} else {
deserializeStatements.push(new Statements(`${ClientRuntime.JsonSerializable}.FromJson( json, ${ap}, null ,${exclusions.value} );`));
}
Expand Down