how to convert jason file data into csv file in python2019 Community Moderator ElectionHow do I check whether a file exists without exceptions?How do I copy a file in Python?How can I safely create a nested directory in Python?How to get the current time in PythonHow can I make a time delay in Python?Converting integer to string in Python?Convert form data to JavaScript object with jQueryHow to concatenate two lists in Python?How do I list all files of a directory?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?

Is it "Vierergruppe" or "Viergruppe", or is there a distinction?

weren't playing vs didn't play

How can I get players to stop ignoring or overlooking the plot hooks I'm giving them?

Hotkey (or other quick way) to insert a keyframe for only one component of a vector-valued property?

Child Theme Path Being Ignored With wp_enqueue_scripts

Intuition behind counterexample of Euler's sum of powers conjecture

Can I pump my MTB tire to max (55 psi / 380 kPa) without the tube inside bursting?

Reverse string, can I make it faster?

Declaring and defining template, and specialising them

Latex does not go to next line

cat shows nothing

What was the Kree's motivation in Captain Marvel?

'The literal of type int is out of range' con número enteros pequeños (2 dígitos)

PTIJ: Should I kill my computer after installing software?

Is "conspicuously missing" or "conspicuously" the subject of this sentence?

Accepted offer letter, position changed

Why is computing ridge regression with a Cholesky decomposition much quicker than using SVD?

Does "Until when" sound natural for native speakers?

Examples of a statistic that is not independent of sample's distribution?

Is it work or heat?

How strictly should I take "Candidates must be local"?

How is the wildcard * interpreted as a command?

Shifting between bemols (flats) and diesis (sharps)in the key signature

Error during using callback start_page_number in lualatex



how to convert jason file data into csv file in python



2019 Community Moderator ElectionHow do I check whether a file exists without exceptions?How do I copy a file in Python?How can I safely create a nested directory in Python?How to get the current time in PythonHow can I make a time delay in Python?Converting integer to string in Python?Convert form data to JavaScript object with jQueryHow to concatenate two lists in Python?How do I list all files of a directory?How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?










0















I have .json file which have this type of data ,the name of universities of the world



[

"web_pages": [
"https://www.cstj.qc.ca",
"https://ccmt.cstj.qc.ca",
"https://ccml.cstj.qc.ca"
],
"name": "Cégep de Saint-Jérôme",
"alpha_two_code": "CA",
"state-province": null,
"domains": [
"cstj.qc.ca"
],
"country": "Canada"
,

"web_pages": [
"http://www.lindenwood.edu/"
],
"name": "Lindenwood University",
"alpha_two_code": "US",
"state-province": null,
"domains": [
"lindenwood.edu"
],
"country": "United States"
,
{
"web_pages": [
.......
.....
....
...
Continue......



I want to convert this .json file into CSV using Python, What will be its solution to make the CSV file?










share|improve this question






















  • First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

    – Luca Bezerra
    Mar 6 at 15:32











  • Do you have Pandas, or you want to do this with only core Python?

    – Supratim Haldar
    Mar 6 at 15:36











  • @SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

    – itsme
    Mar 6 at 15:37











  • Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

    – Supratim Haldar
    Mar 6 at 15:51












  • @SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

    – itsme
    Mar 6 at 16:06
















0















I have .json file which have this type of data ,the name of universities of the world



[

"web_pages": [
"https://www.cstj.qc.ca",
"https://ccmt.cstj.qc.ca",
"https://ccml.cstj.qc.ca"
],
"name": "Cégep de Saint-Jérôme",
"alpha_two_code": "CA",
"state-province": null,
"domains": [
"cstj.qc.ca"
],
"country": "Canada"
,

"web_pages": [
"http://www.lindenwood.edu/"
],
"name": "Lindenwood University",
"alpha_two_code": "US",
"state-province": null,
"domains": [
"lindenwood.edu"
],
"country": "United States"
,
{
"web_pages": [
.......
.....
....
...
Continue......



I want to convert this .json file into CSV using Python, What will be its solution to make the CSV file?










share|improve this question






















  • First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

    – Luca Bezerra
    Mar 6 at 15:32











  • Do you have Pandas, or you want to do this with only core Python?

    – Supratim Haldar
    Mar 6 at 15:36











  • @SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

    – itsme
    Mar 6 at 15:37











  • Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

    – Supratim Haldar
    Mar 6 at 15:51












  • @SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

    – itsme
    Mar 6 at 16:06














0












0








0








I have .json file which have this type of data ,the name of universities of the world



[

"web_pages": [
"https://www.cstj.qc.ca",
"https://ccmt.cstj.qc.ca",
"https://ccml.cstj.qc.ca"
],
"name": "Cégep de Saint-Jérôme",
"alpha_two_code": "CA",
"state-province": null,
"domains": [
"cstj.qc.ca"
],
"country": "Canada"
,

"web_pages": [
"http://www.lindenwood.edu/"
],
"name": "Lindenwood University",
"alpha_two_code": "US",
"state-province": null,
"domains": [
"lindenwood.edu"
],
"country": "United States"
,
{
"web_pages": [
.......
.....
....
...
Continue......



I want to convert this .json file into CSV using Python, What will be its solution to make the CSV file?










share|improve this question














I have .json file which have this type of data ,the name of universities of the world



[

"web_pages": [
"https://www.cstj.qc.ca",
"https://ccmt.cstj.qc.ca",
"https://ccml.cstj.qc.ca"
],
"name": "Cégep de Saint-Jérôme",
"alpha_two_code": "CA",
"state-province": null,
"domains": [
"cstj.qc.ca"
],
"country": "Canada"
,

"web_pages": [
"http://www.lindenwood.edu/"
],
"name": "Lindenwood University",
"alpha_two_code": "US",
"state-province": null,
"domains": [
"lindenwood.edu"
],
"country": "United States"
,
{
"web_pages": [
.......
.....
....
...
Continue......



I want to convert this .json file into CSV using Python, What will be its solution to make the CSV file?







python json python-3.x csv






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 6 at 15:29









itsmeitsme

55




55












  • First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

    – Luca Bezerra
    Mar 6 at 15:32











  • Do you have Pandas, or you want to do this with only core Python?

    – Supratim Haldar
    Mar 6 at 15:36











  • @SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

    – itsme
    Mar 6 at 15:37











  • Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

    – Supratim Haldar
    Mar 6 at 15:51












  • @SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

    – itsme
    Mar 6 at 16:06


















  • First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

    – Luca Bezerra
    Mar 6 at 15:32











  • Do you have Pandas, or you want to do this with only core Python?

    – Supratim Haldar
    Mar 6 at 15:36











  • @SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

    – itsme
    Mar 6 at 15:37











  • Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

    – Supratim Haldar
    Mar 6 at 15:51












  • @SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

    – itsme
    Mar 6 at 16:06

















First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

– Luca Bezerra
Mar 6 at 15:32





First of all, I'd advise you to try parsing the JSON with a different encoding - your current one seems to be generating all sorts of weird characters.

– Luca Bezerra
Mar 6 at 15:32













Do you have Pandas, or you want to do this with only core Python?

– Supratim Haldar
Mar 6 at 15:36





Do you have Pandas, or you want to do this with only core Python?

– Supratim Haldar
Mar 6 at 15:36













@SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

– itsme
Mar 6 at 15:37





@SupratimHaldar I am using simple IDL python 3.6 ,Install it and then I am using it.

– itsme
Mar 6 at 15:37













Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

– Supratim Haldar
Mar 6 at 15:51






Okay. I am adding this as a comment rather than an answer because this solution involves Pandas. import json from pandas.io.json import json_normalize with open('infile.json') as json_data: d = json.load(json_data) df = json_normalize(d) df.to_csv('outfile.csv', index=False)

– Supratim Haldar
Mar 6 at 15:51














@SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

– itsme
Mar 6 at 16:06






@SupratimHaldar I have Install the pandas ,Can you Give me as a Answer

– itsme
Mar 6 at 16:06













1 Answer
1






active

oldest

votes


















0














This solution uses Pandas.



import json
from pandas.io.json import json_normalize

with open('infile.json') as json_data:
d = json.load(json_data)

df = json_normalize(d)
df.to_csv('outfile.csv', index=False)


Also, as @LucaBezerra has mentioned in the comments, the current text has some encoding problem which you might want to fix (look at the first "name").






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026677%2fhow-to-convert-jason-file-data-into-csv-file-in-python%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This solution uses Pandas.



    import json
    from pandas.io.json import json_normalize

    with open('infile.json') as json_data:
    d = json.load(json_data)

    df = json_normalize(d)
    df.to_csv('outfile.csv', index=False)


    Also, as @LucaBezerra has mentioned in the comments, the current text has some encoding problem which you might want to fix (look at the first "name").






    share|improve this answer



























      0














      This solution uses Pandas.



      import json
      from pandas.io.json import json_normalize

      with open('infile.json') as json_data:
      d = json.load(json_data)

      df = json_normalize(d)
      df.to_csv('outfile.csv', index=False)


      Also, as @LucaBezerra has mentioned in the comments, the current text has some encoding problem which you might want to fix (look at the first "name").






      share|improve this answer

























        0












        0








        0







        This solution uses Pandas.



        import json
        from pandas.io.json import json_normalize

        with open('infile.json') as json_data:
        d = json.load(json_data)

        df = json_normalize(d)
        df.to_csv('outfile.csv', index=False)


        Also, as @LucaBezerra has mentioned in the comments, the current text has some encoding problem which you might want to fix (look at the first "name").






        share|improve this answer













        This solution uses Pandas.



        import json
        from pandas.io.json import json_normalize

        with open('infile.json') as json_data:
        d = json.load(json_data)

        df = json_normalize(d)
        df.to_csv('outfile.csv', index=False)


        Also, as @LucaBezerra has mentioned in the comments, the current text has some encoding problem which you might want to fix (look at the first "name").







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 6 at 16:14









        Supratim HaldarSupratim Haldar

        17318




        17318





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026677%2fhow-to-convert-jason-file-data-into-csv-file-in-python%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved