Get Started With The Parser#

The parser parses data strings, e.g. as found in barcodes, into a set of key-value mappings. These data formats are supported: Health Industry Bar Code (HIBC), GS1 Application Identifier (parser/AI) system, AAMVA Driver License/Identification, ICAO Machine Readable Travel Document (parser/MRTD) and Swiss QR Codes, VIN Vehicle Identification Number.

More data formats will be added in future releases. Please contact us if the data format you are using is not yet supported, or you want to use the parser on a currently unsupported platform.


Before starting with adding a capture mode, make sure that you have a valid Scandit Data Capture SDK license key and that you added the necessary dependencies. If you have not done that yet, check out this guide.


You can retrieve your Scandit Data Capture SDK license key, by signing in to your account at

Create the Data Capture Context#

The first step to add barcode capture capabilities to your application is to create a new data capture context. The context expects a valid Scandit Data Capture SDK license key during construction.

DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey("-- ENTER YOUR SCANDIT LICENSE KEY HERE --");

Use the Parser#

In a nutshell, the parser 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 sample shows how the parser code typically looks like.

import com.scandit.datacapture.parser.*;

 Parser parser = Parser.forFormat(dataCaptureContext, ParserDataFormat.GS1_AI);

 ParsedData res = null;
 try {
     res = parser.parseString("1719060110SCANDIT123");
 } catch (IllegalArgumentException e) {
     // Something went wrong.

 // We can either access the data from the raw JSON string ...
 Log.d("JsonString", res.getJsonString());

 // ... or from the fields dictionary ...
 Map<String, ParsedField> map = res.getFieldsByName();
 ParsedField metaField = map.get("17");
 Log.d("FieldRawString", metaField.getRawString());
 // parsed can be a Map<String,Object>, Object[], Integer, Long, Boolean, Double or String
 Object parsed = metaField.getParsed();
 Log.d("OUTPUT", parsed.toString());

 // ... or from the fields array
 List<ParsedField> fields = res.getFields();
 for (ParsedField field : fields){
     final String result = field.getName() + ": " + field.getParsed();
     Log.d("OUTPUT", result);

For details, go to the API docs.