Converti CSV in JSON

Converti CSV in JSON

Aspose.Cells supporta la conversione da CSV a JSON. Per questo, API fornisce**ExportRangeToJsonOptions**e**JsonUtility** classi. Il**ExportRangeToJsonOptions**class fornisce le opzioni per l’esportazione dell’intervallo a JSON. Il**ExportRangeToJsonOptions**class ha le seguenti proprietà.

Il**JsonUtility**class esporta lo JSON utilizzando le opzioni di esportazione impostate con il file**ExportRangeToJsonOptions**classe.

L’esempio di codice seguente illustra l’utilizzo di**ExportRangeToJsonOptions**e**JsonUtility** classi per caricare il filefonte CSV filee stampa l’output JSON nella console.

Codice d’esempio

Uscita console

[
{
"id": 1,
"language": "Java",
"edition": "third",
"author": "Herbert Schildt",
"streetAddress": 126,
"city": "San Jone",
"state": "CA",
"postalCode": 394221
},
{
"id": 2,
"language": "C++",
"edition": "second",
"author": "EAAAA",
"streetAddress": 126,
"city": "San Jone",
"state": "CA",
"postalCode": 394221
},
{
"id": 3,
"language": ".Net",
"edition": "second",
"author": "E.Balagurusamy",
"streetAddress": 126,
"city": "San Jone",
"state": "CA",
"postalCode": 394221
}
]