xml_converter 1.2.0 copy "xml_converter: ^1.2.0" to clipboard
xml_converter: ^1.2.0 copied to clipboard

The XML Converter is a Dart package that provides functionality to convert XML strings to JSON format and Dart classes and saves it in the specified project structure.,This package is designed to faci [...]

example/xml_converter_example.dart

import 'package:xml_converter/src/xml_converter_base.dart';

void main() async {
  final xmlConverter = XmlConverterBase();

  // create an XML string
  String jsonString = '''
<weatherInfo>
    <weather>sunny</weather>
    <clouds>no</clouds>
    <time>11.30</time>
    <sportsYouCanDo>
        <sport1>running</sport1>
        <sport2>hiking</sport2>
        <sport3>biking</sport3>
    </sportsYouCanDo>
    <anyMap>
        <key1>value 1</key1>
        <key2>value 2</key2>
    </anyMap>
</weatherInfo>
''';

  // convert XML to JSON and save it to a file
  await xmlConverter.convertXmlToJsonFile(jsonString, 'users');

  // convert JSON to Dart class and save it to a file
   xmlConverter.convertXmlToDartClass(jsonString, 'Users', 'users');
}
0
likes
130
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

The XML Converter is a Dart package that provides functionality to convert XML strings to JSON format and Dart classes and saves it in the specified project structure.,This package is designed to facilitate the handling of XML data in Dart applications by offering a simple and efficient way to transform XML into usable formats.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

xml, xml2json

More

Packages that depend on xml_converter