google / google/gson

How to set some property above after converting class to sting using toJson Method

Open
#1,880 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

I have a screenshot class. and I doing serialization Gson().toJson(objOfClass). but I need to set SEQ,& SRC property before the DEVAWSEP so how could I set it?

{"state":{"desired":{"ACT":1,"DEVAWSEP":"xxxxxxxxx",**"SEQ":6048799,"SRC":"MA"**}}}

I want this form
{"state":{"desired":{"ACT":1,**"SEQ":6048799,"SRC":"MA",**"DEVAWSEP":"xxxxxxxxx"}}}

**so I want to do to serialization without alphabet order**

ScreenShot of my class
![Screenshot 2021-04-06 at 7 02 55 PM](https://user-images.githubusercontent.com/64843262/113719603-68959500-970b-11eb-9bee-5508948da40e.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.