(function() { /* Queries the GATT table in - https://www.bluetooth.com/specifications/gatt/characteristics - https://www.bluetooth.com/specifications/gatt/services - https://www.bluetooth.com/specifications/gatt/descriptors to print the info as JSON { { "id": "org.bluetooth.service.generic_access", "name": "Generic Access", "code": "0x1800", "specification": "GSS" }, { "id": "org.bluetooth.service.generic_attribute", "name": "Generic Attribute", "code": "0x1801", "specification": "GSS" } ,... } */ var rows = document.querySelectorAll("tr[class]"); var data = []; Array.prototype.forEach.call(rows, (row) => { data.push({ id: row.children[1].innerText, name: row.children[0].innerText, code: row.children[2].innerText, specification: row.children[3].innerText }); }); // sorting by code data = data.sort((a, b) => { if (a.code < b.code) return -1; if (a.code > b.code) return 1; return 0; }); console.log(JSON.stringify(data, null, 2)); })(); /* Gets the java static list from above data */ function getJavaStaticList(data) { var result = ''; data.forEach(d=>{ result += `attributes.put("0000${d.code.substr(2).toLowerCase()}-0000-1000-8000-00805f9b34fb", "${d.name}");\n`; }); return result; }