Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

saving a json file in a text file

Tags:

json

c#

I have a link like translate.google.com/translate_a/t?client=t&text=like&hl=en&sl=en&tl=bn&ie=UTF-8&oe=UTF-8&multires=1&otf=2&ssel=4&tsel=0&otf=1&ssel=4&tsel=0&sc=1.

Here in text=like it will change like text=book text=pen, which means it will be my input word, and I will loop it for 1000 times.

I'm making a dictionary. The above url outputs JSON data.

I want to loop through 1000 words and get their json output into one text file - how can I do that in c#?

like image 596
ImonBayazid Avatar asked Nov 23 '25 01:11

ImonBayazid


1 Answers

see this sample maybe usfull

Person person = GetPerson();


    using (FileStream fs = File.Open(@"c:\person.json", FileMode.CreateNew))
    using (StreamWriter sw = new StreamWriter(fs))
    using (JsonWriter jw = new JsonTextWriter(sw))
    {
      jw.Formatting = Formatting.Indented;

      JsonSerializer serializer = new JsonSerializer();
      serializer.Serialize(jw, person);
    }

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!