Problemas com json HTML?

o Json está retornando com " , como faço para resolver isso ???
Desde já obrigado pela atenção.

The operation Visible cannot accept the arguments: , [" [{"REGSUS":"898002774419788","NOME":"LAURINDA ALVES FERREIRA","MICRO":"1"},{"REGSUS":"704306599620293","NOME":"CELIOMAR MESQUITA SANTOS","MICRO":"1"},{"REGSUS":"704708793751932","NOME":"KAMILLA NUNES DA SILVA","MICRO":"1"},{"REGSUS":"898002766873858","NOME":"MARIA ALVES DE JESUS","MICRO":"1"},{"REGSUS":"898004803014592","NOME":"LUCAS GABRIEL NOVAIS SANTOS","MICRO":"1"},{"REGSUS":"702806675754363","NOME":"ROSANGELA MARIA DE SOUZA PIMENTA","MICRO":"1"},{"REGSUS":"700805477146785","NOME":"JOSE BONFIM DE FREITAS PIMENTA","MICRO":"1"},{"REGSUS":"898004117632983","NOME":"QUEREN HAPUQUE FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"898003471992008","NOME":"HEZION SAMUEL FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"708203672544645","NOME":"MARCOS MARCELINO NUNES DUARTE","MICRO":"1"}] "]
Note: You will not see another error reported for 5 seconds.

Post a screenshot of you blocks , most probably instead of set text you use set visible and this can only accept true or false

Tenho um App para consultar um cadastro de cliente via php que estava funcionando hà 2 anos ontem fiz a troca de servidor e começou a aparecer essa mensagem :
" The second argument to foreach is not a list. The second argument is: ""
Note: You will not see another error reported for 5 seconds."
Exemplo do meu Json :
[{"REGSUS":"898002774419788","NOME":"LAURINDA ALVES FERREIRA","MICRO":"1"},{"REGSUS":"704306599620293","NOME":"CELIOMAR MESQUITA SANTOS","MICRO":"1"},{"REGSUS":"704708793751932","NOME":"KAMILLA NUNES DA SILVA","MICRO":"1"},{"REGSUS":"898002766873858","NOME":"MARIA ALVES DE JESUS","MICRO":"1"},{"REGSUS":"898004803014592","NOME":"LUCAS GABRIEL NOVAIS SANTOS","MICRO":"1"},{"REGSUS":"702806675754363","NOME":"ROSANGELA MARIA DE SOUZA PIMENTA","MICRO":"1"},{"REGSUS":"700805477146785","NOME":"JOSE BONFIM DE FREITAS PIMENTA","MICRO":"1"},{"REGSUS":"898004117632983","NOME":"QUEREN HAPUQUE FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"898003471992008","NOME":"HEZION SAMUEL FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"708203672544645","NOME":"MARCOS MARCELINO NUNES DUARTE","MICRO":"1"}]

o código php continua o mesmo :

<?php session_start(); require_once('base_de_datos.php'); $sql = "SELECT cast(REGSUS as char) as REGSUS,NOME,cast(psfmicro as dec) as MICRO, cast(prontuario as DEC) as ID FROM pacientes where cast(psfmicro as dec)=1 limit 1"; $stmt_lista=$base_de_datos->prepare($sql); $stmt_lista->execute(); $clientes=array(); while($dados = $stmt_lista->fetch(PDO::FETCH_OBJ)) { $clientes[] = array("REGSUS"=>$dados->REGSUS,"NOME"=>$dados->NOME,"MICRO"=>$dados->MICRO); } echo json_encode($clientes); ?>

You can work with dictionary blocks and web component to get data from json

Example

1 Like


o visible eu inserir só para eu ver o retorno do json

See

Change set Label1 visible to set label1 text
image

1 Like

What are you trying to do here?

image

Also see

image


Bom dia, aqui no brasil ainda é manhã, desde já obrigado pela atenção, estou dando os meus primeiros passos em app inventor, o json está retornando essas tags html, penso que é isso que está dando o erro.

Post here your url if you wish, most probably the response is in html fromat not json

http://educacaoglaucilandia.criarsite.online/saude/app_listapac.php

<?php require_once('base_de_datos.php'); $sql = "SELECT cast(REGSUS as char) as REGSUS,NOME,cast(psfmicro as dec) as MICRO, cast(prontuario as DEC) as ID FROM pacientes where cast(psfmicro as dec)=1 limit 10"; $stmt_lista=$base_de_datos->prepare($sql); $stmt_lista->execute(); $clientes=array(); while($dados = $stmt_lista->fetch(PDO::FETCH_OBJ)) { $clientes[] = array("REGSUS"=>$dados->REGSUS,"NOME"=>$dados->NOME,"MICRO"=>$dados->MICRO); } //$clientes= html_entity_decode(json_encode($clientes)); echo json_encode($clientes); //header('Content-type: application/json'); //echo json_encode($rows); //var_dump($row); //mysqli_free_result($resultado); //mysqli_close($conexao2); ?>

Try this way

3 Likes

Muito obrigado pela atenção

1 Like

A simpler way perhaps, Your json file is a json according to https://jsonlint.com/

Response from provided url is

<html></hmtl>[{"REGSUS":"898002774419788","NOME":"LAURINDA ALVES FERREIRA","MICRO":"1"},{"REGSUS":"704306599620293","NOME":"CELIOMAR MESQUITA SANTOS","MICRO":"1"},{"REGSUS":"704708793751932","NOME":"KAMILLA NUNES DA SILVA","MICRO":"1"},{"REGSUS":"898002766873858","NOME":"MARIA ALVES DE JESUS","MICRO":"1"},{"REGSUS":"898004803014592","NOME":"LUCAS GABRIEL NOVAIS SANTOS","MICRO":"1"},{"REGSUS":"702806675754363","NOME":"ROSANGELA MARIA DE SOUZA PIMENTA","MICRO":"1"},{"REGSUS":"700805477146785","NOME":"JOSE BONFIM DE FREITAS PIMENTA","MICRO":"1"},{"REGSUS":"898004117632983","NOME":"QUEREN HAPUQUE FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"898003471992008","NOME":"HEZION SAMUEL FREITAS CONCEICAO","MICRO":"1"},{"REGSUS":"708203672544645","NOME":"MARCOS MARCELINO NUNES DUARTE","MICRO":"1"}]

Interesting:

You missed the html tags at the beginning :wink:

Response

Using json to dictionaries gives error that's why I removed <html></html>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.