Interpret GS1 scan is a JavaScript library that interprets the string of data in various GS1 formats, as found in barcodes of different types.
You might want to head over to the demo.
This demo does not work in all browsers. It seems to work well with:
- Samsung Internet on Android
- Chrome on Android
It is usable but without the beep or choice of camera when used with Safari on iOS
It does not work with Chrome on iOS
It does not work with Firefox on Windows
We'll do what we can to improve this but a lot of it is down to the underlying libraries.
Interpret GS1 scan depends on the GS1 Digital Link toolkit.
If there are no errors, the interpretScan()
function returns an object as follows
AIbrackets
: The equivalent GS1 element string in human-readable AI syntaxAIfnc1
: The equivalent GS1 element string in AI syntax with FNC1 (as used in barcodes)dl
: The equivalent GS1 Digital Link URL (on id.gs1.org)ol
: An ordered array of objects parsed/interpreted from the input string:ai
: the GS1 Application Identifierlabel
: what that AI is used forvalue
: the value
The order for the ol
list matches that found in a GS1 Digital Link URI
- primary identifier
- any applicable qualifiers
- any data attributes
- any non-GS1 AIs and their values
Simply pass the string to be interpreted to the interpretScan() function.
It can handle any of the 3 formats:
- Human readable AI syntax (i.e. with brackets)
- Pure AI syntax (i.e. with the FNC1 character)
- GS1 Digital Link URI
If the input string cannot be interpreted, i.e. it's not a valid GS1 string, then the returned object has a value for errmsg
which is the system error message.