More binding languages and data formats will be added in future releases. Please contact us if the data format you are using is not supported by the library, or you want to use the Scandit Parser Library on a yet-unsupported platform.

Installation: For Android and iOS, the parser library is embedded in the Scandit SDK. For information on how to install it, consult the Scandit SDK documentation.

In a nutshell, the Scandit Parser Library provides functionality to transform a data string and into a list of key-value pairs. To use this functionality in your app, first the parser must be instantiated with the desired format. The result is then returned in a result object. The following two samples show how the parser code typically looks like on the different platforms.

Android Example:

importcom.scandit.parser.*;importorg.json.*;importjava.util.HashMap;......// picker: BarcodePicker object from Scandit SDKParserp=picker.createParserForFormat(DataFormat.GS1AI);ParserResultres=null;try{res=parser.parseString("1719060110SCANDIT123");}catch(IllegalArgumentExceptione){// Something went wrong.}// We can either acces the data from the raw JSON string ...Log.d(TAG,res.getJsonString());// ... or from the fields dictionary ...HashMap<String,Field>map=res.getFieldsDict();FieldmetaField=map.get("17");Log.d(TAG,metaField.getRaw());// parsed can be a Map<String,Object>, Object[], Integer, Long, Boolean, Double or StringObjectparsed=metaField.getParsed();Log.d(TAG,metaField.getRaw());Log.d(TAG,parsed.toString());// ... or from the fields arrayField[]fields=res.getFieldsArray();for(inti=0;i<fields.length;i++){Log.d(TAG,fields[i].getName());Log.d(TAG,fields[i].getRaw());Objectp=fields[i].getParsed();Log.d(TAG,p.toString());}// Using the parser tools class we can easily extract dates from corresponding fieldsFielddateField=map.get("17");Calendardate=ParserTools.dateFromParsedObject(dateField.getParsed());SimpleDateFormatformat=newSimpleDateFormat("yyyy-MM-dd");Log.d(TAG,format.format(date.getTime()));

#import <ScanditParser/ScanditParser.h>...NSError*err;// Replace SBSDataFormatHIBC with the data format of your choice.// picker: SBSBarcodePicker object from Scandit SDKSBSParser*parser=[pickerparserForFormat:SBSParserDataFormatHIBCerror:&err];if(!parser){// Something went wrong. Look at err for more info.}SBSParserResult*result=[parserparseString:@"+A99912345/$$52001510X33"error:&err];if(!result){// Something went wrong. Look at err for more info.}// We can either access the data from the raw JSON string...NSLog(@"%@",result.jsonString);// ... or from the fields dictionary...NSDictionary<NSString*,SBSField*>*fieldsDictionary=result.fieldsDict;for(NSString*keyinfieldsDictionary.allKeys){SBSField*field=[fieldsDictionaryobjectForKey:key];NSLog(@"%@ name: %@",key,field.name);NSLog(@"%@ raw: %@",key,field.rawString);NSLog(@"%@ parsed: %@",key,field.parsed);}// ... or from the fields arrayfor(SBSField*fieldinresult.fieldsArray){NSLog(@"%@ raw: %@",field.name,field.rawString);NSLog(@"%@ parsed: %@",field.name,field.parsed);}

varstring='+A123BJC5D6E71G';varoptions=null;try{varresult=ScanditParser.parseString(ScanditParser.Type.HIBC,string,options);}catch(e){// Something went wrong}// We can directly access the json object ...console.log(result.json);// .. or we can acces individual fields by namevarfield=result.getFieldByName("metadata");console.log(field.parsed);console.log(field.rawString);