import java.io.*;
import javax.json.*;

/**
 * An example of "naive" serialization using JSON.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class PersonDriver
{
    /**
     * The entry point of the application.
     *
     * @param args  The command line arguments (ignored)
     */
    public static void main(String[] args) throws Exception
    {
        File file = new File("person.json");
        
        BufferedReader in = new BufferedReader(new FileReader(file));
        JsonReader reader = Json.createReader(in);
        JsonObject person = reader.readObject();
        
        Person p = Person.parsePerson(person);
        System.out.println(p.toJSON());
    }
}
