i want to make a simple json from some key values of String type that values are utf-8 but after joining direction and structure of joining are pretty damaged
public static void main(String[] args) {
int k1=1;
int k2=2;
int k3=3;
String v1="مقدار1";
String v2="مقدار2";
String v3="مقدار3";
javax.swing.JOptionPane.showMessageDialog(null, "{\""+k1+"\":\""+v1+"\",\""+k2+"\":\""+v2+"\",\""+k3+"\":\""+v3+"\"}");
System.out.println("Json that created:\r\n"+
"{\""+k1+"\":\""+v1+"\",\""+k2+"\":\""+v2+"\",\""+k3+"\":\""+v3+"\"}");
}
correct result must be this : { "1" : "مقدار3" : "3" , "مقدار2" : "2" , "مقدار1" }
if you run it in the link you see that is not correct!
but maybe that is reasons of console and if you see it on the swing component you see direction is vice-versa (RtL) but not damaged
in the json structure first input is always key and should not to change it by UTF-8 Direction
maybe your fast solution is to first add value then key but i have english words too and i want to have a standard way to dont having again problem
how can i to fix that and make a correct json structure by these triple key (k1,k2,k3) and values(v1,v2,v3)?
that is reason of console (even swing component) and when i created json and send it to a client (think that is a ajax request/response and client is a JavaScript code) , js worked as fine to json structure and there is not any problem