La salida JSON de Census Geocoder se convierte al conjunto de datos Xml utilizando JSON.net en C #

Estoy creando una aplicación .Net en Visual Studio 2012 que consulta una tabla de direcciones en mi dB de SQL y usa la API de codificación geográfica del censo para devolver el MSA específico para cada dirección. Tengo un código existente para la consulta dB, pero tengo problemas para convertir la salida Json de la API del censo en un conjunto de datos Xml. Estoy usando Json.net para serializar la salida json y luego deserializar a .net para cargar en un XmlDocument. Desafortunadamente, sigo recibiendo un error de XmlException:

Los datos a nivel de la raíz no es válida. Línea 1, posición 1

Detalles:

System.Xml.XmlException no se manejó HResult = -2146232000
Mensaje = Los datos en el nivel raíz no son válidos. Línea 1, posición 1.
Fuente = System.Xml LineNumber = 1 LinePosition = 1 SourceUri = ""
StackTrace: en System.Xml.XmlTextReaderImpl.Throw (Excepción e) en System.Xml.XmlTextReaderImpl.Throw (String res, String arg) en System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace () en System.Xml.XmlTextRes) System.Xml.XmlTextReaderImpl.Read () en System.Xml.XmlLoader.Load (XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) en System.Xml.XmlDocument.Load (XmlReader reader) en System.Xml.XmlDocument.Loadmlml (Strml) ) en ConsoleApplication1.Program.Main (String [] args) en c: \ Users \ jdsmith \ Documents \ Visual Studio 2012 \ Projects \ C # \ MSA_Application_v2 \ MSA_Application_v2 \ Model \ Program.cs: línea 54 en System.AppDomain._nExecuteAssembly ( Ensamblaje RuntimeAssembly, String [] args) en System.AppDomain.ExecuteAssembly (String assemblyFile, Evidence assemblySecurity, String [] args) en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly () en System.Threading.ThreadHelper.ThreadStert.ThreadStert.Thread en System.Threading.ExecutionContext.RunIntern al (ExecutionContext executeContext, ContextCallback callback, Estado del objeto, Boolean preserveSyncCtx) en System.Threading.ExecutionContext.Run (ExecutionContext executeContext, ContextCallback callback, Estado del objeto, Boolean preserveSyncCtx) en System.Threading.ExecutionContext.RunCon, BackContext, ExecuteContext Estado del objeto) en System.Threading.ThreadHelper.ThreadStart () InnerException:

Creo que Json o Xml deben formatearse más, pero no sé cómo. Además, estoy seguro de que estoy haciendo esto demasiado difícil para mí ... si hay una mejor manera, soy todo oídos.

Aquí está la muestra de geolocalización que estoy usando para probar:

http://geocoding.geo.census.gov/geocoder/geographies/address?street=4600+Silver+Hill+Rd&city=Suitland&state=MD&benchmark=Public_AR_Census2010&vintage=Census2010_Census2010&layers=14&format=json

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Data;
using System.Net;
using System.IO;
using System.Xml;
using System.Runtime.Serialization.Json;
using System.Xml.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        private static string geoRT = "geographies";
        private static string geoST = "address";
        private static string geoStreet = "4600+Silver+Hill+Rd";
        private static string geoCity = "Suitland";
        private static string geoState = "MD";
        private static string geoZip = "20746";
        private static string geoBM = "Public_AR_Census2010";
        private static string geoVin = "Census2010_Census2010";
        private static string geoLayer = "all";
        private static string geoFormat = "json";
        static void Main(string[] args)
        {
            StringBuilder geoRelURI = new StringBuilder();
            geoRelURI.AppendFormat(@"{0}/{1}?street={2}&city={3}&state={4}&zip={5}&benchmark={6}&vintage={7}&layers={8}&format={9}"
                , geoRT, geoST, geoStreet, geoCity, geoState, geoZip, geoBM, geoVin, geoLayer, geoFormat);

            Uri geoBaseURI = new Uri("http://geocoding.geo.census.gov/geocoder/");
            Uri geoURI = new Uri(geoBaseURI, geoRelURI.ToString());

            //Console.WriteLine(geoURI);
            //Console.ReadLine();

            WebRequest geoRequest = WebRequest.Create(geoURI);
            WebResponse geoResponse = geoRequest.GetResponse();

            Stream geoDataStream = geoResponse.GetResponseStream();
            StreamReader geoReader = new StreamReader(geoDataStream);
            string geoString = geoReader.ReadToEnd();
            var jsonConvert = JsonConvert.SerializeObject(geoString);
            string jsonString = jsonConvert.ToString();
            var xmlConvert = JsonConvert.DeserializeObject(jsonString);
            string xmlString = xmlConvert.ToString();

            XmlDocument geoXMLDoc = new XmlDocument();
            geoXMLDoc.LoadXml(xmlString);

            XmlWriterSettings xmlSettings = new XmlWriterSettings();
            xmlSettings.Indent = true;

            XmlWriter geoXMLWriter = XmlWriter.Create("geoXML.xml", xmlSettings);
            geoXMLDoc.Save(geoXMLWriter);

            Console.Write("<BR>" + geoXMLDoc.OuterXml);

            //Console.WriteLine(xmlString);
            //Console.ReadLine();

            geoDataStream.Close();
            geoResponse.Close();

        }
    }
}

Respuestas a la pregunta(2)

Su respuesta a la pregunta