-4
I have a rather large object on which I need to search it. I have several objects inside and several arrays.For this reason it would not be feasible to give one console.log
in each attribute until you find what you wanted. It would be quite laborious,:
Dentrodeobject object searches for "string" the code I created was this one
var xml = require("fs");
var parser = require('fast-xml-parser');
var wtf = require('wtf_wikipedia');
xml.readFile('wiktionary.part_9.xml',function(erro,documento){
if(erro){
console.log("ERRO: " + erro);
}
var tObj = parser.getTraversalObj(documento);
var jsonObj = parser.convertToJson(tObj);
var t = wtf(jsonObj.mediawiki.page.revision.text).json();
});
But I don’t know how to query inside the T object that returns me
{ title: undefined,
categories:
[ 'Substantivo (Português)',
'Substantivo (Esperanto)',
'Cognato (Esperanto)',
'Substantivo (Franco-Provençal)',
'Substantivo (Galego)',
'Substantivo (Ido)' ],
sections:
[ { title: '', depth: 0, paragraphs: [Array], templates: [Array] },
{ title: 'Substantivo',
depth: 0,
paragraphs: [Array],
templates: [Array],
lists: [Array] },
{ title: 'Expressões',
depth: 1,
paragraphs: [Array],
lists: [Array] },
{ title: '', depth: 1, paragraphs: [Array], templates: [Array] },
{ title: 'Tradução',
depth: 1,
paragraphs: [Array],
templates: [Array] },
{ title: '', depth: 0, templates: [Array] },
{ title: 'Ver também', depth: 0 },
{ title: 'No Wikcionário',
depth: 1,
paragraphs: [Array],
templates: [Array],
lists: [Array] },
{ title: 'Expressões',
depth: 2,
paragraphs: [Array],
templates: [Array],
lists: [Array] },
{ title: 'Apêndices', depth: 2, paragraphs: [Array] },
{ title: 'Wikisaurus',
depth: 2,
paragraphs: [Array],
templates: [Array] },
{ title: 'Substantivo',
depth: 0,
paragraphs: [Array],
templates: [Array] },
{ title: '', depth: 0, templates: [Array] },
{ title: '', depth: 0, paragraphs: [Array], templates: [Array] },
{ title: 'Ver também', depth: 0 },
{ title: 'No Wikcionário',
depth: 1,
paragraphs: [Array],
templates: [Array] },
{ title: 'Substantivo',
depth: 0,
paragraphs: [Array],
templates: [Array] },
{ title: 'Ver também', depth: 0 },
{ title: 'No Wikcionário',
depth: 1,
paragraphs: [Array],
templates: [Array] },
{ title: 'Substantivo',
depth: 0,
paragraphs: [Array],
templates: [Array] },
{ title: 'Ver também', depth: 0 },
{ title: 'No Wikcionário',
depth: 1,
paragraphs: [Array],
templates: [Array] },
{ title: 'Substantivo',
depth: 0,
paragraphs: [Array],
templates: [Array] },
{ title: 'Ver também', depth: 0 },
{ title: 'No Wikcionário', depth: 1, templates: [Array] } ] }
As you can see, there are several objects and arrays and I don’t know where is what I’m looking for,
Always try to put your code and where you are struggling, what you have tried to do... easier to get help like this here on the forum
– Leticia Rosa
Thanks,I created the account today,I don’t know how to use the forum
– mecatrônica com reciclagem
Take a look at the help center of the forum, it will help in the next ones: https://answall.com/help
– Leticia Rosa