Winsoft has a group of components which read and write JSON and CSV files under Android and IOS (in addition to Windows). They are commercial components but each component is available separately for each OS (they also come in a package). The sample code for working with CSV files looks like it is very easy to use. The CSV component supports UTF8, selecting what field separator you want to use, and what end of line character you would like to use in addition to single or double quote items.
with TCsv.Create do
try
LoadAnsiFile(TPath.GetDocumentsPath + PathDelim + 'data.csv');
ShowMessage(ToString);
if (LineCount > 1) and (FieldCount[1] > 2) then
Fields[1, 2] := 'New value';
ShowMessage(ToString);
finally
Free;
end;
They all come with free trials. Check out the CSV component for Android. Check out the CSV component for IOS. Check out the CSV component for Windows.
The JSON component supports literals, numbers, strings, arrays, and objects. Date and time encoding and decoding are also both supported. Full source code comes with the components when you buy them as well. Here is a sample of using the JSON component:
var Json: TJson;
with TJsonParser.Create do
try
Json := ParseUtf8File(TPath.GetDocumentsPath + PathDelim + 'data.json');
try
ShowMessage(Json.ToString);
finally
Json.Free;
end;
finally
Free;
end;
They all come with free trials. Check out the JSON component for Android. Check out the JSON component for IOS. Check out the JSON component for Windows.
If you want the JSON and CSV components for all platforms it could be kind of pricy individually but Winsoft also offers a package of 86 components which include the JSON and CSV components for all platforms for only $200 so that is pretty cheap.
Also keep in mind there is a free JSON cross platform called XSuperObject.
Head over and check out the full package of 86 components available from Winsoft.
1 Comment