I need to parse a file of this format,such that i can get/fetch the values present in place of those tags.
My file looks like this :
   {"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":701,"main":"Mist","description":"mist","icon":"50d"},{"id":721,"main":"Haze","description":"haze","icon":"50d"}],"base":"stations","main":{"temp":277.93,"pressure":1031,"humidity":81,"temp_min":275.15,"temp_max":281.15},"visibility":8000,"wind":{"speed":3.6,"deg":50},"clouds":{"all":0},"dt":1458206447,"sys":{"type":1,"id":5091,"message":0.0163,"country":"GB","sunrise":1458194902,"sunset":1458238189},"id":2643743,"name":"London","cod":200}
I need to fetch each and every value and need to eliminate all the delimiters.
For example, I need every variable with its attributes on new line.
like :
coord:- lon:0.13, lat:51.51
weather:-id:701, 
main:Mist,
description:mist
icon:50d
I have added the code on which I was working. I tried doing the parsing using split operations but it isn't working. I also tried it with JSONParser and scanner operation. The code is below :
package com.weather;
import java.util.Scanner;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.*;
import java.net.*;
import java.util.StringTokenizer;
import org.json.*;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class webApp
{   
    public String getwebApp(String url)
    {
        try
        {
                URL WeatherDisp=new URL(url);
                URLConnection yc = WeatherDisp.openConnection();
                BufferedReader in = new BufferedReader(new    InputStreamReader(yc.getInputStream()));
                String inputLine;
                inputLine=in.readLine();
                return inputLine; 
        }
        catch(Exception e)
        {
            return e.getMessage();
        }
    }
public static void main(String [] url)
{
    //private static final 
    String filePath = "C:\\Users\\abc\\Downloads\\weather\\temp.json";
    Path path = Paths.get(filePath);
    try
    {
         webApp obj=new webApp();
         String a;
         a=obj.getwebApp("http://api.openweathermap.org/data/2.5/weather?                       q=London,uk&appid=6fc5e84445c330ed737da5dee07d1866");
         System.out.println(a);
         File file=new File("temp.json");
         file.createNewFile();
         if(!file.exists())
             file.createNewFile();
         BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsoluteFile()));
         bw.write(a);
         bw.close();
         Scanner scanner = new Scanner(path);
          //read file line by line
          scanner.useDelimiter(System.getProperty("line.separator"));
          while(scanner.hasNext())
          {
                System.out.println("Lines: "+scanner.next());
          }
          scanner.close();  */
         FileReader input = new FileReader("temp.json");
         BufferedReader bufRead = new BufferedReader(input);
         String myLine = null;
         while ( (myLine = bufRead.readLine()) != null)
         {    
             String[] array1 = myLine.split("}");
             System.out.println(array1);
         }
         bufRead.close();
    /*   FileReader reader = new FileReader(filePath);
         JSONParser jsonParser = new JSONParser();
         JSONObject jsonObject = (JSONObject)jsonParser.parse(reader);
         String coord=(String)jsonObject.get("coord");
         System.out.println(coord); */
         }
          catch(Exception e1)
          {
               System.out.println("Error during reading/writing");
          }  
}
}
 
     
    