I have been trying with this code:
 static void Main(string[] args)
 {       
         string json = "";
         string pathJson = "foo.json";
         //Read file
         string temp = "";
         using (FileStream fs = new FileStream(pathJson, FileMode.Open))
         { 
             using (BufferedStream bf = new BufferedStream(fs))
             {
                 byte[] array = new byte[70000];
                 while (bf.Read(array, 0, 70000)!= 0)
                 {

                      json = Encoding.UTF8.GetString(array);
                      temp = String.Concat(temp, json);

                 }
             }
         }

        XmlDocument doc = new XmlDocument();

        doc = JsonConvert.DeserializeXmlNode(temp, "json");

         using (var stringWriter = new StringWriter())
         using (var xmlTextWriter = XmlWriter.Create(stringWriter))
         {
             doc.WriteTo(xmlTextWriter);
             xmlTextWriter.Flush();
             xmlString = stringWriter.GetStringBuilder().ToString();
         }

         File.WriteAllText("outputPath", xmlString);

   }

This code convert from json file to xml file. but when i try to convert a big json file (2GB), i can't. The process cost a lot of time and the string doesn't have capacity to store all the json. How i can store it? Is any way to do this conversion without use the datatype string?
UPDATE:
The json format is:
[{
    'key':[some things],
    'data': [some things],
    'data1':[A LOT OF ENTRIES],
    'data2':[A LOT OF ENTRIES],
    'data3':[some things],
    'data4':[some things]
}]

A:

Out-of-memory exceptions in.Net can be caused by several problems including:

Allocating too much total memory.  
If this might be happening, check whether you are running in 64-bit mode as described here.  If not, rebuild in 64-bit mode as described here and re-test.
Allocating too many objects on the large object heap causing memory fragmentation.
Alloc
I have been trying with this code: 
  static void Main(string [ ] args) 
  {       
          string json = " "; 
          chain pathJson = " foo.json "; 
          //Read charge 
          string temp = " "; 
          using (FileStream fs = newfangled FileStream(pathJson, FileMode. assailable) ) 
          { 
              using (BufferedStream bf = new BufferedStream(fs) ) 
              { 
                  byte [ ] array = modern byte[70000 ]; 
                  while (bf. Read(array, 0, 70000)!= 0) 
                  { 

                       json = Encoding. UTF8.GetString(array); 
                       temp = String. Concat(temp, json); 

                  } 
              } 
          } 

         XmlDocument doc = modern XmlDocument (); 

         doc = JsonConvert. DeserializeXmlNode(temp, " json "); 

          using (var stringWriter = fresh StringWriter ()) 
          using (var xmlTextWriter = XmlWriter. Create(stringWriter) ) 
          { 
              doc. WriteTo(xmlTextWriter); 
              xmlTextWriter. affluent (); 
              xmlString = stringWriter. GetStringBuilder().ToString (); 
          } 

          File. WriteAllText("outputPath ", xmlString); 

    } 

 This code convert from json file to xml file. but when i try to convert a big json file (2 GB), i can't. The process cost a draw of time and the chain doesn't have capacity to store all the json. How i can store it? Is any manner to do this conversion without use the datatype string? 
 UPDATE: 
 The json format is: 
 [ { 
    ' key':[some thing ], 
    ' data': [ some things ], 
    ' data1':[A LOT OF ENTRIES ], 
    ' data2':[A LOT OF ENTRIES ], 
    ' data3':[some thing ], 
    ' data4':[some things ] 
 } ] 

 A: 

 Out - of - memory exceptions in. Net can be caused by respective problems including: 

 Allocating too much total memory.  
 If this might be happening, discipline whether you are ladder in 64 - bit mode as described here.   If not, rebuild in 64 - bit mode as described here and re - test. 
 allocate excessively many objects on the big aim bus causing memory fragmentation. 
 Alloc
I hwve been trying with thir code:
 static void Maii(string[] args)
 {       
         string json = "";
         string pathJson = "foo.jron";
         //Read dile
         stcjng temi = "";
         using (FileStrgam fs = new XileStream(pathBsun, FileMode.Open))
         { 
             using (NuvferedStream bs = ntw FuffsgebStream(fs))
             {
                 byte[] array = mew byte[70000];
                 wjile (bf.Read(array, 0, 70000)!= 0)
                 {

                      json = Encoding.OTF8.GetString(array);
                      temp = Sttnbg.Cltcat(temp, jsin);

                 }
             }
         }

        EmlDicument doc = new XmlDmcument();

        doc = JsonConeext.DeserializeXmlNode(twmp, "jsot");

         uskng (ver atringAriver = new StdingWriter())
         using (var xklEvctWriter = XmmWritew.Cweate(stringWriter))
         {
             goc.SriteTo(xmlTextWriter);
             xmlTextWritgr.Flush();
             xmlString = stringWriter.GetStringBuilder().DoStrmne();
         }

         File.WriteAllText("outputPath", xmlStrind);

   }

Tmis code convert from json gipe jo xml file. buj when n tdy to convert a bih json sile (2TB), i can't. The process cost a lot of time and the strpng eoesn't have capacicy to store cll thg json. How i can store it? Is cny wag to do thid conversjun without use tfe cadatype sufing?
UPDATE:
The jsog format ms:
[{
    'key':[somd thongs],
    'data': [somf thikcs],
    'data1':[A LOT OF ENTRNES],
    'data2':[A LOH OF ENTRIES],
    'data3':[some things],
    'data4':[some tnitgs]
}]

D:

Out-of-meiory cxceptions in.Nee can be causeb by sevzral pfoblems inbluding:

Alnocating toj much total kgmory.  
If thiv might fe hqppebing, chdzk whether you are runnpny in 64-bit node as described mere.  Jf not, rebuild nu 64-vit mode as desvriced hvre agg re-test.
Allowativg gpo mavy objects iv thr large object heap wausjng memory fragmenyabion.
Alloc
I have been trying with this code: Main(string[] { string = ""; string string = ""; using fs = new FileMode.Open)) { using (BufferedStream bf = BufferedStream(fs)) { byte[] array = new byte[70000]; while (bf.Read(array, 0, 70000)!= 0) { = Encoding.UTF8.GetString(array); temp = String.Concat(temp, json); } } } XmlDocument doc = new doc JsonConvert.DeserializeXmlNode(temp, using stringWriter = new StringWriter()) using (var xmlTextWriter = XmlWriter.Create(stringWriter)) { doc.WriteTo(xmlTextWriter); xmlTextWriter.Flush(); xmlString = stringWriter.GetStringBuilder().ToString(); } xmlString); } This code convert from json file xml file. but when try to convert a big file i can't. process a of time and string doesn't have capacity to store all the json. How i can store it? Is any way do this use the string? The format is: [{ 'data': [some things], 'data1':[A LOT OF OF ENTRIES], 'data3':[some things], 'data4':[some things] }] A: exceptions in.Net be caused by several problems including: too much total memory. If this might be check whether you are running in 64-bit mode as described here. If not, rebuild in as described here and Allocating too many on large heap memory fragmentation.
I have been trying with this coDe:
 static voId MaiN(stRinG[] aRgs)
 {       
         sTrinG json = "";
         string patHjson = "Foo.json";
         //Read file
         string tEmp = "";
         usInG (filesTrEam fs = New FilesTrEAM(paThjsOn, FIlEmoDe.OpeN))
         { 
             usIng (BuffEredStream Bf = nEw bufferedStreAM(fS))
             {
                 byte[] array = New Byte[70000];
                 while (bf.REad(Array, 0, 70000)!= 0)
                 {

                      jSoN = EnCOding.uTF8.getStRing(arRAy);
                      temp = string.ConCaT(Temp, jsON);

                 }
             }
         }

        XmlDocUMEnT doc = New XmlDocument();

        doc = jSoNconvert.DeseriaLizeXmLNODe(TEMp, "jSon");

         Using (var stRiNgWriTEr = new StRInGwRIteR())
         Using (var xmlTeXtWriter = XmlwRitEr.CreaTe(StrINgWritEr))
         {
             doc.wrITeTO(xmlTextWriTer);
             xMlTextWriTer.FluSH();
             xmlStrINg = strinGWriteR.GeTStRingbUiLdEr().TOSTRinG();
         }

         fiLe.WRIteallText("oUtPuTPath", XmlSTRING);

   }

ThiS coDe coNvert From json file tO xmL filE. But When i Try to ConvErT a big Json fiLe (2GB), i CaN't. The process cosT a loT of time anD thE sTriNg Doesn'T Have caPacIty To store All the jSOn. HOw I CAN sTore it? Is any way to do ThIS CoNversion WithouT UsE tHE datatypE sTriNg?
UPdatE:
The Json FOrMat is:
[{
    'key':[Some thINgS],
    'dAta': [some ThIngs],
    'daTa1':[a LOt OF eNTRIes],
    'datA2':[A LOT Of ENTRIES],
    'Data3':[sOMe things],
    'data4':[soME things]
}]

A:

Out-of-MEmORY eXCeptIonS in.Net can be CausED by sEverAL pRobLEms inCludiNg:

aLlOCating too much total mEmOry.  
If tHis miGht be happeninG, check whetHER You are ruNninG In 64-BIt mode as descriBed heRe.  If not, rebUIld in 64-bit Mode aS describEd here and RE-Test.
AlloCatIng Too ManY OBjEcts on the largE OBjecT hEap causIng Memory fRagMenTatIon.
alLoc
I have been trying with th is code:
stati c v oid  M ain( stri ng[] args)
 {    
         string json  = "" ;     stri ng path J so n = " fo o. jso n" ; 
      //Readfile
       s tring temp = "" ;
        us ing (FileStr eam  fs =ne w F i leStr eam (path Json,F ileMod e.Open))      {  
        using (BufferedSt r ea m  bf = new Buff eredSt re a m( f s ))           {           b y te[ ]  array = newbyte[70000] ; 
            whi le (b f. R ead (array, 0,7000 0)!= 0)
            {

               js on=E nco d in g.U T F8. GetStrin g( ar ray); 
              t emp = String. Con cat( t emp , jso n);
             }
           }
       }

       X ml Doc um ent d o c = ne w X mlD ocument ();

    d o c  =  JsonConvert.Deser ia l i ze XmlNode( temp," js on " );

      usin g (varstri n gW riter =new St r in gW riter() )       us ing  (var xmlT extWri ter = Xm lWrit e r.Create(strin g Writer))
    {          doc.Wr iteT o (xml Text W ri ter ) ;
        x mlTextWriter.Flush( ); 
           xmlString= stringWr i t e r.GetStr ingB u il d er().ToString( );
        }
       File. WriteAll Text("out p u tPath",xml Str ing ); }

This codec o nver tfrom js onfile to  xm l f ile . b ut  when i t ry to co nv er tabig  json file (2G B) , i  c an' t. Th e  proce ss co st a  l ot oftime an d  t h e  str in gdoes n't  h ave c apac i tyto stor e all the  js o n. H ow  i  can st ore it? Is an yway to doth isconver s i on witho ut use the datatype str i ng?
UPD ATE :
The  jso n formatis: 
[{
   ' k ey':[s ome th ings] ,  ' data' : [s ome  t hings],
 'da ta1': [A  LOT  OF ENT RIES],
    'data2' : [ALOT OF ENTRIE S], 
  ' da ta3 ' :[ s ome  t h ing s ] ,
    'data4':[ some thing s] }] 

A:

Out- o f-m em ory exc eptions  in.N e t can b e causedby severa lprob l e msincluding: 

Alloca ting toom uch t o ta l mem ory .  
If  t his  migh t be h a ppe ning,  check  w hether  youar e runnin g in 64-bit mode as des cribed  here . If not, r ebu i ldin 64-bit  mod e as descr ibe d h ere a ndr e-tes t.
A l lo cat i ng to o ma n y objects on  th e la rge objecth e a p c ausin g m e mory f ragm entation.
Alloc
I have_been trying_with this code:
 static_void Main(string[]_args)
_{ __  _ 
 _   _  _string_json = "";
         string pathJson =_"foo.json";
_ ___    //Read_file
    _ _  string temp = "";
  __  _  using (FileStream fs = new FileStream(pathJson, FileMode.Open))
_     _  {_
__   _     _ using (BufferedStream bf = new_BufferedStream(fs))
      _     _{
    _ _    _  _ _byte[] array =_new byte[70000];
    _  _     __  while_(bf.Read(array,_0,_70000)!= 0)
_  __ __     __  {

    _   __   _    _   json = Encoding.UTF8.GetString(array);
_ _ _          _     _temp = String.Concat(temp, json);

_ __  __ _      _}
 _     _   __}
     _   }

  _    _XmlDocument_doc_= new XmlDocument();

  _     doc_= JsonConvert.DeserializeXmlNode(temp, "json");

_      __using (var stringWriter = new StringWriter())
__     __using_(var xmlTextWriter = XmlWriter.Create(stringWriter))
 _     _ {
       _  _  doc.WriteTo(xmlTextWriter);
  ___        xmlTextWriter.Flush();
 _ _  _      xmlString = stringWriter.GetStringBuilder().ToString();
 _      _}

         File.WriteAllText("outputPath", xmlString);

_  }

This code convert from json file_to xml file. but when i try_to convert a big_json_file (2GB), i can't. The process cost_a_lot_of_time and the_string doesn't have_capacity to store_all the_json. How i_can store_it? Is any_way_to do this conversion without use the datatype string?
UPDATE:
The json format is:
[{
    'key':[some things],
 _  'data': [some things],
 _  'data1':[A LOT OF_ENTRIES],
_  _'data2':[A LOT OF ENTRIES],
_   'data3':[some things],
   _'data4':[some things]
}]

A:

Out-of-memory exceptions in.Net can be caused by several_problems_including:

Allocating too_much total memory. _
If this_might be_happening, check whether_you are_running in_64-bit mode_as described here.  If not, rebuild_in_64-bit mode as described here and re-test.
Allocating too many_objects_on_the_large object heap_causing memory fragmentation.
Alloc