Skip to content

Reading JSON or XML

olmelabs edited this page Nov 29, 2017 · 1 revision

Reading JSON

string json = @"{
    'Type': 'M',
    'Name': 'M_940',
    'Content': [{
        'Type': 'S',
        'Name': 'W05',
        'Content': [ { 'E': 'N' }, { 'E': '538686' }, { 'E': '' }, { 'E': '001001' }, { 'E': '538686' }]
    }]
}";
M_940 map = new M_940();
JsonMapReader r = new JsonMapReader(map);
EdiTrans t = r.ReadToEnd(json);

Reading XML

string xml = @"<EdiTrans>
        <Name>M_940</Name>
        <Content>
            <EdiSegment>
                <Name>W05</Name>
                <Content>
                    <E>N</E>
                    <E>538686</E>
                    <E />
                    <E>001001</E>
                    <E>538686</E>
                </Content>
            </EdiSegment>
        </Content>
    </EdiTrans>";
M_940 map = new M_940();
XmlMapReader r = new XmlMapReader(map);
EdiTrans t = r.ReadToEnd(xml);
Clone this wiki locally