Output is printing in reverse order when i am using JSON please suggest | Selenium Forum
S
SEBASTIAN GNANANAND GIDUTHURI Posted on 24/09/2020

package JsonFileHandling;

import org.json.simple.JSONObject;

public class Json {

@SuppressWarnings("unchecked")
public static void main(String[] args) {

//creating Json oject in java

JSONObject jo = new JSONObject();
jo.put("username","anand");
jo.put("password","password");
System.out.print(jo.toJSONString());

}

}

 

output

{"password":"password","username":"anand"}

 

expected:

{"username":"anand","password":"password"}