An Error Occurred: Exception [EclipseLink-4002] - javascript

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.11.payara-p1): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: java.lang.reflect.UndeclaredThrowableException Error Code: 0 Call: SELECT ID AS a1, Apellido AS a2, Cedula AS a3, Correo AS a4, Edad AS a5, Nombre AS a6, Telefono AS a7 FROM Empleado LIMIT ? OFFSET ? bind => [2 parameters bound] Query: ReadAllQuery(referenceClass=Empleado sql="SELECT ID AS a1, Apellido AS a2, Cedula AS a3, Correo AS a4, Edad AS a5, Nombre AS a6, Telefono AS a7 FROM Empleado LIMIT ? OFFSET ?")
enter image description here
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.11.payara-p1): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: java.lang.reflect.UndeclaredThrowableException Error Code: 0 Call: SELECT ID AS a1, Apellido AS a2, Cedula AS a3, Correo AS a4, Edad AS a5, Nombre AS a6, Telefono AS a7 FROM Empleado LIMIT ? OFFSET ? bind => [2 parameters bound] Query: ReadAllQuery(referenceClass=Empleado sql="SELECT ID AS a1, Apellido AS a2, Cedula AS a3, Correo AS a4, Edad AS a5, Nombre AS a6, Telefono AS a7 FROM Empleado LIMIT ? OFFSET ?")

Related

Regex test method returning more than a specific string [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 11 months ago.
Improve this question
I'm trying to search a specific string like 9.7 in an array using regex test method, but, it's returning values that contains 1984, 1987 in the same row and also 9.7 rows.
searchText= '9.7';
items = [ {description: "MERCEDES BENZ L 1519 - OM 355/5 9.7 L 10V SOHV L5 1973 1987"}, {description: "MERCEDES BENZ LB 2219 - OM 355/5 9.7 L 10V SOHV L5 1973 1980"}, {description: "MERCEDES BENZ LS 1932 - OM 355/6 LA 11.6 L 12V SOHV L6 1984 1987"}, {description: "MERCEDES BENZ O 370 RSD OM 355/5 11.6 L 10V SOHV L5 1985 1987"} ]
let returnArray = [],
splitText = searchText.toLowerCase().split(/\s+/),
regexp_and = '(?=.*' + splitText.join(')(?=.*') + ')',
re = new RegExp(regexp_and, 'i');
for (let x = 0; x < items.length; x++) {
if (re.test(items[x][field])) {
returnArray.push(items[x]);
}
}
return returnArray;
Expected output:
array = [ {description: "MERCEDES BENZ L 1519 - OM 355/5 9.7 L 10V SOHV L5 1973 1987"}, {description: "MERCEDES BENZ LB 2219 - OM 355/5 9.7 L 10V SOHV L5 1973 1980"}]
Could anyone help me?
Thanks.
The . is a special char meaning any character. So when your search string contains it you need to escape it or it will be treated like the wildcard.
use
const splitText = searchText
.toLowerCase()
.split(/\s+/)
.map(token=>token.replace(/\./g,'\\.'));
but keep in mind that this might happen with other special characters
const searchText = '9.7';
const items = [{
description: "MERCEDES BENZ L 1519 - OM 355/5 9.7 L 10V SOHV L5 1973 1987"
}, {
description: "MERCEDES BENZ LB 2219 - OM 355/5 9.7 L 10V SOHV L5 1973 1980"
}, {
description: "MERCEDES BENZ LS 1932 - OM 355/6 LA 11.6 L 12V SOHV L6 1984 1987"
}, {
description: "MERCEDES BENZ O 370 RSD OM 355/5 11.6 L 10V SOHV L5 1985 1987"
}];
const returnArray = [];
const splitText = searchText
.toLowerCase()
.split(/\s+/)
.map(token => token.replace(/\./g, '\\.'));
const regexp_and = '(?=.*' + splitText.join(')(?=.*') + ')';
const re = new RegExp(regexp_and, 'i');
const field = 'description';
for (let x = 0; x < items.length; x++) {
if (re.test(items[x][field])) {
returnArray.push(items[x]);
}
}
console.log(returnArray);

Json to csv dynamic columns javascript

I have a array of objects and i need to convert to a csv, but those objects has dynamics keys, i already create my csv columns using the object with the greater amount of keys ,now i need that if a row doesnt have the atribute the column must be empty.
My current aproach:
let output = [{
"De 0 a 10, qual a chance de você RECOMENDAR o Compass?": "7",
"De 0 a 10, que nota atribui à QUALIDADE do Compass": "8",
"Alguns destes itens já apresentou defeito?": "Painel do Motorista.",
"Pergunta teste insertção dinâmica": "Painel do Motorista"
},
{
"De 0 a 10, qual a chance de você RECOMENDAR o Compass?": "7",
"De 0 a 10, que nota atribui à QUALIDADE do Compass": "8",
"Test Question":"foo",
"Alguns destes itens já apresentou defeito?": "Painel do Motorista.",
"Test 2 Question":"bar",
"Pergunta teste insertção dinâmica": "Painel do Motorista",
}]
let key = 0;
let max = 0;
output.forEach(function(v, k) {
if (max < +Object.keys(v).length) {
max = +Object.keys(v).length;
key = k;
}
});
let csvContent = "data:text/csv;charset=utf-8,";
csvContent += [
Object.keys(output[key]).join(";"),
...output.map(item => {
console.log(item)
console.log( Object.values(item).join(";"))
;
})
]
.join("\n")
.replace(/(^\[)|(\]$)/gm, "");
const csv = encodeURI(csvContent);
const link = document.createElement("a");
link.setAttribute("href", csv);
link.setAttribute("download", "export.csv");
link.click();
},
Current CSV output:
De 0 a 10 qual a chance de você RECOMENDAR o Compass?,De 0 a 10 que nota atribui à QUALIDADE do Compass,Test Question,Alguns destes itens já apresentou defeito?,Test 2 Question,Pergunta teste insertção dinâmica
7,8,Painel do Motorista,Painel do Motorista,Painel do Motorista,Painel do Motorista
5,5,foo,Painel do Motorista,bar,Painel do Motorista
Desired CSV output (if object doesnt have property the column must be empty):
De 0 a 10 qual a chance de você RECOMENDAR o Compass?,De 0 a 10 que nota atribui à QUALIDADE do Compass,Test Question,Alguns destes itens já apresentou defeito?,Test 2 Question,Pergunta teste inserção dinâmica.
7,8,,Painel do Motorista,,Painel do Motorista
5,5,foo,Painel do Motorista,bar,Painel do Motorista
Appreciate any help, thanks in advance.
I see in your function:
console.log( Object.values(item).join(";"))
you just join all the existing values of item. Try to map it with keys:
console.log(Object.keys(output[key]).map(it => item[it] || '').join(";"))
This will iterate through existing composed headers for the csv, retrieve value if exist and add empty string otherwise
Also do not forget return valu from ...output.map(): currently it contains only console.log operations
let csvContent = "data:text/csv;charset=utf-8,";
csvContent += [
Object.keys(output[key]).join(";"),
...output.map(item => {
return Object.keys(output[key]).map(it => item[it] || '').join(";");
})
]
.join("\n")
.replace(/(^\[)|(\]$)/gm, "");

how can i get json property which has multiple spaces within the name?

"technicalData": [
{
"Technologie": "Bluetooth Low Energy 4.0",
"Größe (L x B x H)": "34.4 x 32.5 x 13 mm",
"Gewicht": "018 kg",
"Software": "Für die Arbeit benötigt, aber nicht im Lieferumfang enthalten. Registrierung für kostenlose Software-Verwendung und Premium-Services unter: www.bosch-trackmytools.com",
"Batterie": "CR 2032",
"Batterie Lebensdauer": "3 J",
"IP Schutzklasse": "IP 67",
"Robustheit": "IK 04",
"Befestigung": "2-Komponenten-Klebstoff oder Kabelhalter GCA 30-9 Professional"
}
]
I need to get "Größe (L x B x H)" butcant because it has multiple spaces, ["naming it "] doesnt work
At first, you have to proper define your json dictionary as follow:
json_dict = {"technicalData": [
{
"Technologie": "Bluetooth Low Energy 4.0",
"Größe (L x B x H)": "34.4 x 32.5 x 13 mm",
"Gewicht": "018 kg",
"Software": "Für die Arbeit benötigt, aber nicht im Lieferumfang enthalten. Registrierung für kostenlose Software-Verwendung und Premium-Services unter: www.bosch-trackmytools.com",
"Batterie": "CR 2032",
"Batterie Lebensdauer": "3 J",
"IP Schutzklasse": "IP 67",
"Robustheit": "IK 04",
"Befestigung": "2-Komponenten-Klebstoff oder Kabelhalter GCA 30-9 Professional"
}
]
}
Afterwards, you can get the property with this print() statement. Caution, the dictionary of interest is inside an array!
print(json_dict['technicalData'][0]['Größe (L x B x H)'])
# 34.4 x 32.5 x 13 mm
Hi that shouldn't be a problem at all, don't forget that your json is inside an array, but I'm sure that if you do this, you will be fine.
technicalData[0]["Größe (L x B x H)"]
It should return "34.4 x 32.5 x 13mm"

How to join Prompt with SetTimeout

I am totally new to Javascript. I started my course just this week. I even don't know if we post HTML code here or not.
I have a question about delaying prompt with if statment.
I tried a lot of things shown here about alerts and confirmation, but they are not applied on prompt.
Here is my code (which is very primitive), so please show me how to delay prompt, with an if statment .
What I want to do is: I want the user to read the choices 1st for 10 seconds before the Prompt shows up, then the prompt gives you a choice. Depending on the choice, the results changes.
<meta chartset = "utf-8">
<h1> Car </h1>
In 10 seconds, you can choose your destination BY NUMBER
<br>
Higiénopolis : 1
<br>
Santa Cécilia : 2
<br>
Vila Madalena : 3
<br>
<script>
var hi = 1
var sc = 2
var vm = 3
var dest=prompt("Choose your destination :");
if(dest==1){
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Higiénopolis.")
document.write("<br> A distancia é : 7 km")
document.write("<br> O tempo para chegar é : 28 min")
}
if(dest==2){
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Santa Cécilia.")
document.write("<br> A distancia é : 9,4 km")
document.write("<br> O tempo para chegar é : 31 min")
}
if(dest==3){
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Vila Madalena.")
document.write("<br> A distancia é : 10 km")
document.write("<br> O tempo para chegar é : 35")
}
</script>
You can use setTimeout
var hi = 1
var sc = 2
var vm = 3
var dest = '';
setTimeout(function() {
dest = prompt("Choose your destination :");
if (dest == 1) {
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Higiénopolis.")
document.write("<br> A distancia é : 7 km")
document.write("<br> O tempo para chegar é : 28 min")
}
if (dest == 2) {
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Santa Cécilia.")
document.write("<br> A distancia é : 9,4 km")
document.write("<br> O tempo para chegar é : 31 min")
}
if (dest == 3) {
document.write("<br>Your position is Caelum.")
document.write("<br>Your destination is Vila Madalena.")
document.write("<br> A distancia é : 10 km")
document.write("<br> O tempo para chegar é : 35")
}
}, 2000)
Note : The conditional statements are also inside setTimeout, because, it is an asynchronous function.
If you want to keep it outside, put it in a different function and call that function
DEMO

How do I access the properties of objects that are placed a javascript object?

I have a php file that sends a json string of objects to my javascript file. I am having problems accessing the properties of objects that are contained within this javascript object.
My php file:
for($i=0; $i<$hitcount; $i++){
if($i == $hitcount-1){
// IF HITCOUNT IS LESS THAN 25 RESULTS
echo json_encode($articleArray);
exit();
}else if($i == 25){
// THERE IS ONLY A MAX OF 25 RESULTS PER REQUEST
echo json_encode($articleArray);
exit();
}else{
$page = $xml -> request -> page ; //always page 1
$title = $xml ->resultList -> result[$i] -> title;
if($title == false){
$title = '';
}
$pmid = $xml ->resultList -> result[$i] -> pmid;
if($pmid == false){
$pmid = '';
}
$authorString = $xml ->resultList -> result[$i] -> authorString;
if($authorString == false){
$authorString ='';
}
$journalTitle = $xml ->resultList -> result[$i] -> journalTitle ;
if($journalTitle ==false){
$journalTitle = '';
}
$pubYear = $xml ->resultList -> result[$i] -> pubYear;
if($pubYear == false){
$pubYear = '';
}
$journalVolume = $xml ->resultList -> result[$i] -> journalVolume;
if($journalVolume == false){
$journalVolume = '';
}
$issue = $xml ->resultList -> result[v] -> issue;
if($issue == false){
$issue = '';
}
$pageInfo = $xml ->resultList -> result[$i] -> pageInfo;
if($pageInfo == false){
$pageInfo = '';
}
$articleArray[] = array(
'hitCount' => $hitcount,
'page' => $page,
'pmid' => $pmid,
'title' => $title,
'authors' => $authorString,
'journalTitle' => $journalTitle,
'pubYear' => $pubYear,
'journalVolume' => $journalVolume,
'issue' => $issue,
'pageInfo' => $pageInfo
);
}
}
my javascript file:
// Retrieve json string
var json_obj = JSON.parse(xmlhttp.responseText);
I have tried the following to access the properties of the objects that are stored in the javascript object:
json_obj[0].title // to access the title of the first object
This just returns:
[object Object]
xmlhttp.responseText:
[{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25745995"},"title":{"0":"Hypoxia upregulates Rab11-family interacting protein 4 through HIF-1\u03b1 to promote the metastasis of hepatocellular carcinoma."},"authors":{"0":"Hu F, Deng X, Yang X, Jin H, Gu D, Lv X, Wang C, Zhang Y, Huo X, Shen Q, Luo Q, Zhao F, Ge T, Zhao F, Chu W, Shu H, Yao M, Fan J, Qin W."},"journalTitle":{"0":"Oncogene"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800835"},"title":{"0":"Kinetic activation of Rab8 guanine nucleotide exchange factor Rabin8 by Rab11."},"authors":{"0":"Feng S, Wu B, Per\u00e4nen J, Guo W."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"99-106"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26032412"},"title":{"0":"Structure-Function Analyses of the Interactions Between Rab11 and Rab14 Small GTPases with their Shared Effector Rab Coupling Protein (RCP)."},"authors":{"0":"Lall P, Lindsay A, Hanscom S, Kecman T, Taglauer ES, McVeigh UM, Franklin E, McCaffrey MW, Khan AR."},"journalTitle":{"0":"J Biol Chem"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25815277"},"title":{"0":"Rab11 in disease progression."},"authors":{"0":"Bhuin T, Roy JK."},"journalTitle":{"0":"Int J Mol Cell Med"},"pubYear":{"0":"2015"},"journalVolume":{"0":"4"},"issue":"","pageInfo":{"0":"1-8"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800843"},"title":{"0":"In vitro and in vivo characterization of the Rab11-GAP activity of Drosophila Evi5."},"authors":{"0":"Laflamme C, Emery G."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"187-194"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"24917558"},"title":{"0":"Vasodilator-stimulated phosphoprotein promotes activation of hepatic stellate cells by regulating Rab11-dependent plasma membrane targeting of transforming growth factor beta receptors."},"authors":{"0":"Tu K, Li J, Verma VK, Liu C, Billadeau DD, Lamprecht G, Xiang X, Guo L, Dhanasekaran R, Roberts LR, Shah VH, Kang N."},"journalTitle":{"0":"Hepatology"},"pubYear":{"0":"2015"},"journalVolume":{"0":"61"},"issue":"","pageInfo":{"0":"361-374"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25480917"},"title":{"0":"Vangl2 cooperates with Rab11 and Myosin V to regulate apical constriction during vertebrate gastrulation."},"authors":{"0":"Ossipova O, Chuykin I, Chu CW, Sokol SY."},"journalTitle":{"0":"Development"},"pubYear":{"0":"2015"},"journalVolume":{"0":"142"},"issue":"","pageInfo":{"0":"99-107"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25831508"},"title":{"0":"TRAPPII regulates exocytic Golgi exit by mediating nucleotide exchange on the Ypt31 ortholog RabERAB11."},"authors":{"0":"Pinar M, Arst HN Jr, Pantazopoulou A, Tagua VG, de los R\u00edos V, Rodr\u00edguez-Salarichs J, D\u00edaz JF, Pe\u00f1alva MA."},"journalTitle":{"0":"Proc Natl Acad Sci U S A"},"pubYear":{"0":"2015"},"journalVolume":{"0":"112"},"issue":"","pageInfo":{"0":"4346-4351"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25305083"},"title":{"0":"Rab11 modulates \u03b1-synuclein-mediated defects in synaptic transmission and behaviour."},"authors":{"0":"Breda C, Nugent ML, Estranero JG, Kyriacou CP, Outeiro TF, Steinert JR, Giorgini F."},"journalTitle":{"0":"Hum Mol Genet"},"pubYear":{"0":"2015"},"journalVolume":{"0":"24"},"issue":"","pageInfo":{"0":"1077-1091"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25862161"},"title":{"0":"A novel role of Rab11 in trafficking GPI-anchored trans-sialidase to the plasma membrane of Trypanosoma cruzi."},"authors":{"0":"Niyogi S, Docampo R."},"journalTitle":{"0":"Small GTPases"},"pubYear":{"0":"2015"},"journalVolume":{"0":"6"},"issue":"","pageInfo":{"0":"8-10"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25673879"},"title":{"0":"The Arf and Rab11 effector FIP3 acts synergistically with ASAP1 to direct Rabin8 in ciliary receptor targeting."},"authors":{"0":"Wang J, Deretic D."},"journalTitle":{"0":"J Cell Sci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"128"},"issue":"","pageInfo":{"0":"1375-1385"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25972173"},"title":{"0":"Synaptic Function of Rab11Fip5: Selective Requirement for Hippocampal Long-Term Depression."},"authors":{"0":"Bacaj T, Ahmad M, Jurado S, Malenka RC, S\u00fcdhof TC."},"journalTitle":{"0":"J Neurosci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"35"},"issue":"","pageInfo":{"0":"7460-7474"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25632160"},"title":{"0":"Myosin Va mediates BDNF-induced postendocytic recycling of full-length TrkB and its translocation into dendritic spines."},"authors":{"0":"Sui WH, Huang SH, Wang J, Chen Q, Liu T, Chen ZY."},"journalTitle":{"0":"J Cell Sci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"128"},"issue":"","pageInfo":{"0":"1108-1122"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25686250"},"title":{"0":"Early steps in primary cilium assembly require EHD1\/EHD3-dependent ciliary vesicle formation."},"authors":{"0":"Lu Q, Insinna C, Ott C, Stauffer J, Pintado PA, Rahajeng J, Baxa U, Walia V, Cuenca A, Hwang YS, Daar IO, Lopes S, Lippincott-Schwartz J, Jackson PK, Caplan S, Westlake CJ."},"journalTitle":{"0":"Nat Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"17"},"issue":"","pageInfo":{"0":"228-240"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25904794"},"title":{"0":"Protein Interacting with C-Kinase 1 Deficiency Impairs Glutathione Synthesis and Increases Oxidative Stress via Reduction of Surface Excitatory Amino Acid Carrier 1."},"authors":{"0":"Wang YN, Zhou L, Li YH, Wang Z, Li YC, Zhang YW, Wang Y, Liu G, Shen Y."},"journalTitle":{"0":"J Neurosci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"35"},"issue":"","pageInfo":{"0":"6429-6443"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26041286"},"title":{"0":"Intracellular Transport of Vaccinia Virus in HeLa Cells Requires WASH-VPEF\/FAM21-Retromer Complexes and Recycling molecules Rab11 and Rab22."},"authors":{"0":"Hsiao JC, Chu LW, Lo YT, Lee SP, Chen TJ, Huang CY, Ping YH, Chang W."},"journalTitle":{"0":"J Virol"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25704914"},"title":{"0":"Mechanisms regulating cell membrane localization of the chemokine receptor CXCR4 in human hepatocarcinoma cells."},"authors":{"0":"Cepeda EB, Dediulia T, Fernando J, Bertran E, Egea G, Navarro E, Fabregat I."},"journalTitle":{"0":"Biochim Biophys Acta"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1853"},"issue":"","pageInfo":{"0":"1205-1218"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26021297"},"title":{"0":"The small GTPase Rab29 is a common regulator of immune synapse assembly and ciliogenesis."},"authors":{"0":"Onnis A, Finetti F, Patrussi L, Gottardo M, Cassioli C, Span\u00f2 S, Baldari CT."},"journalTitle":{"0":"Cell Death Differ"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26004511"},"title":{"0":"Slitrk5 Mediates BDNF-Dependent TrkB Receptor Trafficking and Signaling."},"authors":{"0":"Song M, Giza J, Proenca CC, Jing D, Elliott M, Dincheva I, Shmelkov SV, Kim J, Schreiner R, Huang SH, Castr\u00e9n E, Prekeris R, Hempstead BL, Chao MV, Dictenberg JB, Rafii S, Chen ZY, Rodriguez-Boulan E, Lee FS."},"journalTitle":{"0":"Dev Cell"},"pubYear":{"0":"2015"},"journalVolume":{"0":"33"},"issue":"","pageInfo":{"0":"690-702"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25753037"},"title":{"0":"LTP-triggered cholesterol redistribution activates Cdc42 and drives AMPA receptor synaptic delivery."},"authors":{"0":"Brachet A, Norwood S, Brouwers JF, Palomer E, Helms JB, Dotti CG, Esteban JA."},"journalTitle":{"0":"J Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"208"},"issue":"","pageInfo":{"0":"791-806"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26110570"},"title":{"0":"Predominant Rab-GTPase amplicons contributing to oral squamous cell carcinoma progression to metastasis."},"authors":{"0":"da Silva SD, Marchi FA, Xu B, Bijian K, Alobaid F, Mlynarek A, Rogatto SR, Hier M, Kowalski LP, Alaoui-Jamali MA."},"journalTitle":{"0":"Oncotarget"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26067165"},"title":{"0":"Site-Specific Phosphorylation of VEGFR2 Is Mediated by Receptor Trafficking: Insights from a Computational Model."},"authors":{"0":"Clegg LW, Mac Gabhann F."},"journalTitle":{"0":"PLoS Comput Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"11"},"issue":"","pageInfo":{"0":"e1004158"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25941134"},"title":{"0":"Mechanisms of apical-basal axis orientation and epithelial lumen positioning."},"authors":{"0":"Overeem AW, Bryant DM, van IJzendoorn SC."},"journalTitle":{"0":"Trends Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25394938"},"title":{"0":"The fungal pathogen Cryptococcus neoformans manipulates macrophage phagosome maturation."},"authors":{"0":"Smith LM, Dixon EF, May RC."},"journalTitle":{"0":"Cell Microbiol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"17"},"issue":"","pageInfo":{"0":"702-713"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800842"},"title":{"0":"3D time-lapse analysis of Rab11\/FIP5 complex: spatiotemporal dynamics during apical lumen formation."},"authors":{"0":"Mangan A, Prekeris R."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"181-186"}}]
It's because the title is really an Object.
"title":{
"0":"Hypoxia upregulates Rab11-family interacting protein 4 through HIF-1\u03b1 to promote the metastasis of hepatocellular carcinoma."
}
If you can't change the output try to access like this:
json_obj[0].title["0"];
But would be better if the title comes from your php ready to use. I don't see any reason to return an array in this case.
Try casting the title to a string value:
$title = (string) $xml->resultList->result[$i]->title;
The problem is your XML/JSON conversion in PHP. I'm not sure of your XML structure, but you're currently passing an object instead of a value. Building on #Stefan's answer above, it might be worth simplifying the process with a function:
// get the title, etc...
$title = attr_val( $xml->resultList->result[$i]->title );
function attr_val ( $attr ) {
return (string) ($attr ?: "");
}
You can solve this on the front end as well:
var data = JSON.parse(responseText);
// iterate over each reference
for(i in data) {
// and it's attributes
for(attr in data[i]) {
// look for objects where you were expecting strings
if(data[i][attr].hasOwnProperty("0")) {
// replace with the string you were expecting
data[i][attr] = data[i][attr]["0"];
}
}
}
// You can now access all attributes as expected
data[0].title
// See the full output
document.querySelector('pre').innerHTML = JSON.stringify(data, null, '\t');
<pre></pre><script>var responseText = '[{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25745995"},"title":{"0":"Hypoxia upregulates Rab11-family interacting protein 4 through HIF-1\u03b1 to promote the metastasis of hepatocellular carcinoma."},"authors":{"0":"Hu F, Deng X, Yang X, Jin H, Gu D, Lv X, Wang C, Zhang Y, Huo X, Shen Q, Luo Q, Zhao F, Ge T, Zhao F, Chu W, Shu H, Yao M, Fan J, Qin W."},"journalTitle":{"0":"Oncogene"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800835"},"title":{"0":"Kinetic activation of Rab8 guanine nucleotide exchange factor Rabin8 by Rab11."},"authors":{"0":"Feng S, Wu B, Per\u00e4nen J, Guo W."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"99-106"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26032412"},"title":{"0":"Structure-Function Analyses of the Interactions Between Rab11 and Rab14 Small GTPases with their Shared Effector Rab Coupling Protein (RCP)."},"authors":{"0":"Lall P, Lindsay A, Hanscom S, Kecman T, Taglauer ES, McVeigh UM, Franklin E, McCaffrey MW, Khan AR."},"journalTitle":{"0":"J Biol Chem"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25815277"},"title":{"0":"Rab11 in disease progression."},"authors":{"0":"Bhuin T, Roy JK."},"journalTitle":{"0":"Int J Mol Cell Med"},"pubYear":{"0":"2015"},"journalVolume":{"0":"4"},"issue":"","pageInfo":{"0":"1-8"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800843"},"title":{"0":"In vitro and in vivo characterization of the Rab11-GAP activity of Drosophila Evi5."},"authors":{"0":"Laflamme C, Emery G."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"187-194"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"24917558"},"title":{"0":"Vasodilator-stimulated phosphoprotein promotes activation of hepatic stellate cells by regulating Rab11-dependent plasma membrane targeting of transforming growth factor beta receptors."},"authors":{"0":"Tu K, Li J, Verma VK, Liu C, Billadeau DD, Lamprecht G, Xiang X, Guo L, Dhanasekaran R, Roberts LR, Shah VH, Kang N."},"journalTitle":{"0":"Hepatology"},"pubYear":{"0":"2015"},"journalVolume":{"0":"61"},"issue":"","pageInfo":{"0":"361-374"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25480917"},"title":{"0":"Vangl2 cooperates with Rab11 and Myosin V to regulate apical constriction during vertebrate gastrulation."},"authors":{"0":"Ossipova O, Chuykin I, Chu CW, Sokol SY."},"journalTitle":{"0":"Development"},"pubYear":{"0":"2015"},"journalVolume":{"0":"142"},"issue":"","pageInfo":{"0":"99-107"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25831508"},"title":{"0":"TRAPPII regulates exocytic Golgi exit by mediating nucleotide exchange on the Ypt31 ortholog RabERAB11."},"authors":{"0":"Pinar M, Arst HN Jr, Pantazopoulou A, Tagua VG, de los R\u00edos V, Rodr\u00edguez-Salarichs J, D\u00edaz JF, Pe\u00f1alva MA."},"journalTitle":{"0":"Proc Natl Acad Sci U S A"},"pubYear":{"0":"2015"},"journalVolume":{"0":"112"},"issue":"","pageInfo":{"0":"4346-4351"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25305083"},"title":{"0":"Rab11 modulates \u03b1-synuclein-mediated defects in synaptic transmission and behaviour."},"authors":{"0":"Breda C, Nugent ML, Estranero JG, Kyriacou CP, Outeiro TF, Steinert JR, Giorgini F."},"journalTitle":{"0":"Hum Mol Genet"},"pubYear":{"0":"2015"},"journalVolume":{"0":"24"},"issue":"","pageInfo":{"0":"1077-1091"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25862161"},"title":{"0":"A novel role of Rab11 in trafficking GPI-anchored trans-sialidase to the plasma membrane of Trypanosoma cruzi."},"authors":{"0":"Niyogi S, Docampo R."},"journalTitle":{"0":"Small GTPases"},"pubYear":{"0":"2015"},"journalVolume":{"0":"6"},"issue":"","pageInfo":{"0":"8-10"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25673879"},"title":{"0":"The Arf and Rab11 effector FIP3 acts synergistically with ASAP1 to direct Rabin8 in ciliary receptor targeting."},"authors":{"0":"Wang J, Deretic D."},"journalTitle":{"0":"J Cell Sci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"128"},"issue":"","pageInfo":{"0":"1375-1385"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25972173"},"title":{"0":"Synaptic Function of Rab11Fip5: Selective Requirement for Hippocampal Long-Term Depression."},"authors":{"0":"Bacaj T, Ahmad M, Jurado S, Malenka RC, S\u00fcdhof TC."},"journalTitle":{"0":"J Neurosci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"35"},"issue":"","pageInfo":{"0":"7460-7474"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25632160"},"title":{"0":"Myosin Va mediates BDNF-induced postendocytic recycling of full-length TrkB and its translocation into dendritic spines."},"authors":{"0":"Sui WH, Huang SH, Wang J, Chen Q, Liu T, Chen ZY."},"journalTitle":{"0":"J Cell Sci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"128"},"issue":"","pageInfo":{"0":"1108-1122"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25686250"},"title":{"0":"Early steps in primary cilium assembly require EHD1\/EHD3-dependent ciliary vesicle formation."},"authors":{"0":"Lu Q, Insinna C, Ott C, Stauffer J, Pintado PA, Rahajeng J, Baxa U, Walia V, Cuenca A, Hwang YS, Daar IO, Lopes S, Lippincott-Schwartz J, Jackson PK, Caplan S, Westlake CJ."},"journalTitle":{"0":"Nat Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"17"},"issue":"","pageInfo":{"0":"228-240"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25904794"},"title":{"0":"Protein Interacting with C-Kinase 1 Deficiency Impairs Glutathione Synthesis and Increases Oxidative Stress via Reduction of Surface Excitatory Amino Acid Carrier 1."},"authors":{"0":"Wang YN, Zhou L, Li YH, Wang Z, Li YC, Zhang YW, Wang Y, Liu G, Shen Y."},"journalTitle":{"0":"J Neurosci"},"pubYear":{"0":"2015"},"journalVolume":{"0":"35"},"issue":"","pageInfo":{"0":"6429-6443"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26041286"},"title":{"0":"Intracellular Transport of Vaccinia Virus in HeLa Cells Requires WASH-VPEF\/FAM21-Retromer Complexes and Recycling molecules Rab11 and Rab22."},"authors":{"0":"Hsiao JC, Chu LW, Lo YT, Lee SP, Chen TJ, Huang CY, Ping YH, Chang W."},"journalTitle":{"0":"J Virol"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25704914"},"title":{"0":"Mechanisms regulating cell membrane localization of the chemokine receptor CXCR4 in human hepatocarcinoma cells."},"authors":{"0":"Cepeda EB, Dediulia T, Fernando J, Bertran E, Egea G, Navarro E, Fabregat I."},"journalTitle":{"0":"Biochim Biophys Acta"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1853"},"issue":"","pageInfo":{"0":"1205-1218"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26021297"},"title":{"0":"The small GTPase Rab29 is a common regulator of immune synapse assembly and ciliogenesis."},"authors":{"0":"Onnis A, Finetti F, Patrussi L, Gottardo M, Cassioli C, Span\u00f2 S, Baldari CT."},"journalTitle":{"0":"Cell Death Differ"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26004511"},"title":{"0":"Slitrk5 Mediates BDNF-Dependent TrkB Receptor Trafficking and Signaling."},"authors":{"0":"Song M, Giza J, Proenca CC, Jing D, Elliott M, Dincheva I, Shmelkov SV, Kim J, Schreiner R, Huang SH, Castr\u00e9n E, Prekeris R, Hempstead BL, Chao MV, Dictenberg JB, Rafii S, Chen ZY, Rodriguez-Boulan E, Lee FS."},"journalTitle":{"0":"Dev Cell"},"pubYear":{"0":"2015"},"journalVolume":{"0":"33"},"issue":"","pageInfo":{"0":"690-702"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25753037"},"title":{"0":"LTP-triggered cholesterol redistribution activates Cdc42 and drives AMPA receptor synaptic delivery."},"authors":{"0":"Brachet A, Norwood S, Brouwers JF, Palomer E, Helms JB, Dotti CG, Esteban JA."},"journalTitle":{"0":"J Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"208"},"issue":"","pageInfo":{"0":"791-806"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26110570"},"title":{"0":"Predominant Rab-GTPase amplicons contributing to oral squamous cell carcinoma progression to metastasis."},"authors":{"0":"da Silva SD, Marchi FA, Xu B, Bijian K, Alobaid F, Mlynarek A, Rogatto SR, Hier M, Kowalski LP, Alaoui-Jamali MA."},"journalTitle":{"0":"Oncotarget"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"26067165"},"title":{"0":"Site-Specific Phosphorylation of VEGFR2 Is Mediated by Receptor Trafficking: Insights from a Computational Model."},"authors":{"0":"Clegg LW, Mac Gabhann F."},"journalTitle":{"0":"PLoS Comput Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"11"},"issue":"","pageInfo":{"0":"e1004158"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25941134"},"title":{"0":"Mechanisms of apical-basal axis orientation and epithelial lumen positioning."},"authors":{"0":"Overeem AW, Bryant DM, van IJzendoorn SC."},"journalTitle":{"0":"Trends Cell Biol"},"pubYear":{"0":"2015"},"journalVolume":"","issue":"","pageInfo":""},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25394938"},"title":{"0":"The fungal pathogen Cryptococcus neoformans manipulates macrophage phagosome maturation."},"authors":{"0":"Smith LM, Dixon EF, May RC."},"journalTitle":{"0":"Cell Microbiol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"17"},"issue":"","pageInfo":{"0":"702-713"}},{"hitCount":{"0":"3347"},"page":{"0":"1"},"pmid":{"0":"25800842"},"title":{"0":"3D time-lapse analysis of Rab11\/FIP5 complex: spatiotemporal dynamics during apical lumen formation."},"authors":{"0":"Mangan A, Prekeris R."},"journalTitle":{"0":"Methods Mol Biol"},"pubYear":{"0":"2015"},"journalVolume":{"0":"1298"},"issue":"","pageInfo":{"0":"181-186"}}]';</script>

Categories

Resources