Is there a way to create a Json with field names that contain dots '.' in a JavaScript application (specifically, TypeScript)?
This is the expected Json output:
{
"tasks.max": "1",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"topics": "eraseme_topic_schema_test_v05"
}
I have tried using libraries like ts-jackson and jackson-js. Below is an example code snippet using ts-jackson:
MyDomain.ts
@Serializable()
import { JsonProperty,Serializable } from 'ts-jackson';
export class MyDomain{
@JsonProperty({path: 'tasks.max', elementType: String})
tasks_max: string;
@JsonProperty({path: 'key.converter'})
key_converter: string;
@JsonProperty({path: 'topics'})
topics: string;
}
However, the properties containing dots are being created as subclasses in the Json output instead of direct property fields with dots.
{
tasks: { max: '1' },
key: { converter: { schema: [Object] } },
topics: 'eraseme_topic_schema_test_v05'
}
Is there a way to achieve this functionality in JavaScript by using a Jackson-like library?