Received: by 10.224.219.144 with SMTP id hu16mr5361469qab.1.1353175530505; Sat, 17 Nov 2012 10:05:30 -0800 (PST) X-BeenThere: android-developers@googlegroups.com Received: by 10.49.133.170 with SMTP id pd10ls822208qeb.60.gmail; Sat, 17 Nov 2012 10:00:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.49.76.65 with SMTP id i1mr1586197qew.24.1353175258479; Sat, 17 Nov 2012 10:00:58 -0800 (PST) Authentication-Results: ls.google.com; spf=pass (google.com: domain of psk...@gmail.com designates internal as permitted sender) smtp.mail=psk...@gmail.com; dkim=pass header...@gmail.com Received: by n5g2000vbk.googlegroups.com with HTTP; Sat, 17 Nov 2012 10:00:58 -0800 (PST) Date: Sat, 17 Nov 2012 10:00:58 -0800 (PST) In-Reply-To: References: User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.80 (Android; Opera Mini/7.5.31657/28.3030; U; en) Presto/2.8.119 Version/11.10,gzip(gfe) Message-ID: <612b4a68-d9ae-4c77-8076-c338c483aa01@n5g2000vbk.googlegroups.com> Subject: Re: regarding android json request From: skink To: Android Developers Content-Type: text/plain; charset=ISO-8859-1 nageswara rao Rajana wrote: > Hi, > > JSONObject holder = new JSONObject(); > > holder.put("Key1","Value1"); > holder.put("Key2","Value2"); > holder.put("Key3","Value3"); > holder.put("Key4","Value4"); > > String jsonrequest = holder.toString(); > > > but while sending request the format is changing to > {"Key2":"Value2","Key3":"Value3","Key4":"Value4","Key1":"Value1"} > > but i want this > format {"Key1":"Value1","Key2":"Value2","Key3":"Value3","Key4":"Value4"}. > > > so please help me how can i achieve this. > > > Thanking you, > nagu. see www.json.org: "An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/ value pairs are separated by , (comma)." pskink