flexjson

Change property name with Flexjson

爱⌒轻易说出口 提交于 2019-11-30 23:46:50
I use FlexJson for serialization, the only problem is that it generates the field names lower case while I need them to start with upper case: class Person { String name; public String getName() { return name;} } When serialized the field is serialized as name , while I need it to be Name . How can I specify the output field name? Is there some attribute I can put to specify the required serialization name? Waqas You can achieve this by using a Custom Transformer . As per Flexjson page transformer is: Responsible for deciding how to translate the passed in object to JSON, making the

Change property name with Flexjson

故事扮演 提交于 2019-11-30 18:41:25
问题 I use FlexJson for serialization, the only problem is that it generates the field names lower case while I need them to start with upper case: class Person { String name; public String getName() { return name;} } When serialized the field is serialized as name , while I need it to be Name . How can I specify the output field name? Is there some attribute I can put to specify the required serialization name? 回答1: You can achieve this by using a Custom Transformer . As per Flexjson page