Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Converts JSON to CSV

License

NotificationsYou must be signed in to change notification settings

feluelle/json-to-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Converts JSON to CSV

How it works

The field'sbiggest value size determines thenumber of csv lines.

  • Writes values in each row as long as the biggest size is not reached.
  • The index of the array will be incremented after each row.That means after an array size is reached there won't be further values in this column.

Conditions (to work as expected)

  • The json isnot allowed to have anarray inside anarray.
  • Each object in anarray has to contain thesame fields.

Example

This json..

{    "field1": "value1",    "field2": [1, 2, 3, 4, 5, 6, 7, 8, 9],    "field3": {        "field3-a": 4.0    },    "field4": { },    "field5": [{        "field5-a": 5,        "field5-b": 5.1     }, {        "field5-a": 6,        "field5-b": 6.1     }, {        "field5-a": 7,        "field5-b": 7.1     }, {        "field5-a": 8,        "field5-b": 8.1     }, {        "field5-a": 9,        "field5-b": 9.1     }],    "field6": [ ]}

will be this csv..

field1;field2;field3.field3-a;field4;field5.field5-a;field5.field5-b;field6value1;1;4.0;;5;5.1;value1;2;4.0;;6;6.1;value1;3;4.0;;7;7.1;value1;4;4.0;;8;8.1;value1;5;4.0;;9;9.1;value1;6;4.0;;;;value1;7;4.0;;;;value1;8;4.0;;;;value1;9;4.0;;;;

displayed as a table..

field1field2field3.field3-afield4field5.field5-afield5.field5-bfield6
value114.055.1
value124.066.1
value134.077.1
value144.088.1
value154.099.1
value164.0
value174.0
value184.0
value194.0

Dependencies

json

This library uses com.fasterxml.jackson.core's jackson-databind to deserialize json to a map.

About

Converts JSON to CSV

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp