Parse HTML into Json

Hello Bubblers,

I need help using the API connector, with a GET call.
Initializing is perfectly fine, but the data we obtain is not really a JSON, but very close.

Is there a way to remove the 28 first caracters so this data would be JSON compatible ?
(So Bubble API connector would be able to parse it correctly…)

Thanks you all
Romain

CODE_RETOUR=00000&PRODUITS=[{“reference”:“36302”,“ean”:“”,“designation”:“10 CUISSES DE POULET BIO DEJOINTEES S/VIDE”,“fournisseur”:“PCFA0004”,“unitePrix”:“K”,“prix”:“8.76”,“prixAchat”:“”,“poidsNet”:“2.2”,“delaiCommande”:“10”,“urlPhoto”:“”,“complement”:“200 à 240g”,“categorie”:“poultry”,“fournisseurs”:“”,“secteur”:“PC”,“famille1”:“Poulet”,“famille2”:“”,“famille3”:“”,“famille4”:“”,“typeAgriculture”:“B”,“conditionnement”:“Poche”,“lotissage”:“2”,“colisage”:“0”,“tva”:“1”,“saisonnalite”:“”,“prixUnitaire”:“19.27”,“communeFournisseur”:“FELINES”,“origine”:“Sud-Est”,“transformation”:“”,“url”:“”,“logos”:“[EU][AB][PACA]”,“stockable”:“0”,“disponible”:“”},{“reference”:“1579915798”,“ean”:“”,“designation”:“10 PILONS / 10 HAUTS DE CUISSE (PARITE)”,“fournisseur”:“PCFA0004”,“unitePrix”:“K”,“prix”:“8.79”,“prixAchat”:“”,“poidsNet”:“1.7”,“delaiCommande”:“10”,“urlPhoto”:“”,“complement”:“POULET FERMIER BIO BLANC S/VIDE”,“categorie”:“poultry”,“fournisseurs”:“”,“secteur”:“PC”,“famille1”:“Poulet”,“famille2”:“”,“famille3”:“”,“famille4”:“”,“typeAgriculture”:“B”,“conditionnement”:“Poche”,“lotissage”:“4”,“colisage”:“0”,“tva”:“1”,“saisonnalite”:“”,“prixUnitaire”:“14.94”,“communeFournisseur”:“FELINES”,“origine”:“Ardèche”,“transformation”:“Ardèche”,“url”:“”,“logos”:“[EU][AB][PACA]”,“stockable”:“0”,“disponible”:“”},{“reference”:“82112”,“ean”:“”,“designation”:“4 FILETS POULET FERMIER BIO BLANC S/VIDE”,“fournisseur”:“PCFA0004”,“unitePrix”:“K”,“prix”:“20.61”,“prixAchat”:“”,“poidsNet”:“0.69”,“delaiCommande”:“10”,“urlPhoto”:“”,“complement”:“”,“categorie”:“poultry”,“fournisseurs”:“”,“secteur”:“PC”,“famille1”:“Poulet”,“famille2”:“”,“famille3”:“”,“famille4”:“”,“typeAgriculture”:“B”,“conditionnement”:“Poche”,“lotissage”:“4”,“colisage”:“0”,“tva”:“1”,“saisonnalite”:“”,“prixUnitaire”:“14.22”,“communeFournisseur”:“FELINES”,“origine”:“Sud-Est”,“transformation”:“”,“url”:“”,“logos”:“[EU][AB][PACA]”,“stockable”:“0”,“disponible”:“”},{“reference”:“HETLP1”,“ean”:“”,“designation”:“6 thyms / 6 lauriers sec 12*30gr”,“fournisseur”:“29L4S41H”,"u…

Welcome to the forum @bubble50!

You can :extract with Regex the text, using the following Regex pattern: {“.*$

Then apply the :formatted as JSON-safe to the result and you should be good to go.

[Regex updated]


Follow me on twitter

Hi @jmalmeida,

Thank you!
The problem is, I’ll have a JSON file that i cannot use as a regular data because Bubble didnt parse it first.

Could you provide more context? Describe the steps you take and where do you have the problem. Use screenshots if appropiate.

I think I am trying to do something similar.
I am using the fileuploader thing to enable the user to upload an HTML file to the page.
This file is structured and includes the text -PurchaseOrder-001-/PurchaseOrder-
I then got the Json<>Things Plugin and put it onto the page.
I had hoped that the Json<>Things would read the HTML File and extract the data (“001”)
This did not happen.
do I need to somehow convert the HTML file to Json file?