I want to bring a single value from my json file

Multi tool use
Multi tool use





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















This brings me all the values ​​of the json file



Example: I have id, name and lastname, I want to bring the id value



  fs.readFile("user.json", function (err, data) {
if (err) throw err;
console.log(data.toString());
});


info file json



{"Identificador":0,"Nombre_Principal":"man","Nombre_Paterno":"man","Nombre_Materno":"man","Contrasena":"man","Correo":"man@man.com","Posicion":"User","Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Im1hbiIsIm5iZiI6MTU0MjgzODU5OCwiZXhwIjoxNTQyODQwMzk4LCJpYXQiOjE1NDI4Mzg1OTgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjUyMjQiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjY1MjI0In0.W9Tck4QjzCoP2g0CdFIsmshSUoZbzi8AmzR9EnRYIVQ","Estatus":0}









share|improve this question




















  • 3





    Use JSON.parse() then access what you need as you would with any JavaScript object

    – charlietfl
    Nov 22 '18 at 1:48











  • I could do visual, please

    – Manuel Rodriguez
    Nov 22 '18 at 1:56











  • @Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

    – Spencer Wieczorek
    Nov 22 '18 at 2:03











  • sorry, I did not notice that I put jquery by mistake

    – Manuel Rodriguez
    Nov 22 '18 at 2:03











  • @SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

    – Brad
    Nov 22 '18 at 2:05


















1















This brings me all the values ​​of the json file



Example: I have id, name and lastname, I want to bring the id value



  fs.readFile("user.json", function (err, data) {
if (err) throw err;
console.log(data.toString());
});


info file json



{"Identificador":0,"Nombre_Principal":"man","Nombre_Paterno":"man","Nombre_Materno":"man","Contrasena":"man","Correo":"man@man.com","Posicion":"User","Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Im1hbiIsIm5iZiI6MTU0MjgzODU5OCwiZXhwIjoxNTQyODQwMzk4LCJpYXQiOjE1NDI4Mzg1OTgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjUyMjQiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjY1MjI0In0.W9Tck4QjzCoP2g0CdFIsmshSUoZbzi8AmzR9EnRYIVQ","Estatus":0}









share|improve this question




















  • 3





    Use JSON.parse() then access what you need as you would with any JavaScript object

    – charlietfl
    Nov 22 '18 at 1:48











  • I could do visual, please

    – Manuel Rodriguez
    Nov 22 '18 at 1:56











  • @Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

    – Spencer Wieczorek
    Nov 22 '18 at 2:03











  • sorry, I did not notice that I put jquery by mistake

    – Manuel Rodriguez
    Nov 22 '18 at 2:03











  • @SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

    – Brad
    Nov 22 '18 at 2:05














1












1








1








This brings me all the values ​​of the json file



Example: I have id, name and lastname, I want to bring the id value



  fs.readFile("user.json", function (err, data) {
if (err) throw err;
console.log(data.toString());
});


info file json



{"Identificador":0,"Nombre_Principal":"man","Nombre_Paterno":"man","Nombre_Materno":"man","Contrasena":"man","Correo":"man@man.com","Posicion":"User","Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Im1hbiIsIm5iZiI6MTU0MjgzODU5OCwiZXhwIjoxNTQyODQwMzk4LCJpYXQiOjE1NDI4Mzg1OTgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjUyMjQiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjY1MjI0In0.W9Tck4QjzCoP2g0CdFIsmshSUoZbzi8AmzR9EnRYIVQ","Estatus":0}









share|improve this question
















This brings me all the values ​​of the json file



Example: I have id, name and lastname, I want to bring the id value



  fs.readFile("user.json", function (err, data) {
if (err) throw err;
console.log(data.toString());
});


info file json



{"Identificador":0,"Nombre_Principal":"man","Nombre_Paterno":"man","Nombre_Materno":"man","Contrasena":"man","Correo":"man@man.com","Posicion":"User","Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Im1hbiIsIm5iZiI6MTU0MjgzODU5OCwiZXhwIjoxNTQyODQwMzk4LCJpYXQiOjE1NDI4Mzg1OTgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6NjUyMjQiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjY1MjI0In0.W9Tck4QjzCoP2g0CdFIsmshSUoZbzi8AmzR9EnRYIVQ","Estatus":0}






javascript node.js json






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 2:03







Manuel Rodriguez

















asked Nov 22 '18 at 1:42









Manuel RodriguezManuel Rodriguez

83




83








  • 3





    Use JSON.parse() then access what you need as you would with any JavaScript object

    – charlietfl
    Nov 22 '18 at 1:48











  • I could do visual, please

    – Manuel Rodriguez
    Nov 22 '18 at 1:56











  • @Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

    – Spencer Wieczorek
    Nov 22 '18 at 2:03











  • sorry, I did not notice that I put jquery by mistake

    – Manuel Rodriguez
    Nov 22 '18 at 2:03











  • @SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

    – Brad
    Nov 22 '18 at 2:05














  • 3





    Use JSON.parse() then access what you need as you would with any JavaScript object

    – charlietfl
    Nov 22 '18 at 1:48











  • I could do visual, please

    – Manuel Rodriguez
    Nov 22 '18 at 1:56











  • @Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

    – Spencer Wieczorek
    Nov 22 '18 at 2:03











  • sorry, I did not notice that I put jquery by mistake

    – Manuel Rodriguez
    Nov 22 '18 at 2:03











  • @SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

    – Brad
    Nov 22 '18 at 2:05








3




3





Use JSON.parse() then access what you need as you would with any JavaScript object

– charlietfl
Nov 22 '18 at 1:48





Use JSON.parse() then access what you need as you would with any JavaScript object

– charlietfl
Nov 22 '18 at 1:48













I could do visual, please

– Manuel Rodriguez
Nov 22 '18 at 1:56





I could do visual, please

– Manuel Rodriguez
Nov 22 '18 at 1:56













@Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

– Spencer Wieczorek
Nov 22 '18 at 2:03





@Brad What are you talking about? What was given is fine. An actual JSON file is not needed to answer this question.

– Spencer Wieczorek
Nov 22 '18 at 2:03













sorry, I did not notice that I put jquery by mistake

– Manuel Rodriguez
Nov 22 '18 at 2:03





sorry, I did not notice that I put jquery by mistake

– Manuel Rodriguez
Nov 22 '18 at 2:03













@SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

– Brad
Nov 22 '18 at 2:05





@SpencerWieczorek The whole question is how to access properties of an object. Seeing an actual structure is helpful.

– Brad
Nov 22 '18 at 2:05












1 Answer
1






active

oldest

votes


















1














Before you can access the actual data inside the string containing JSON, you have to parse it first. Use JSON.parse() for this.



fs.readFile('user.json', function (err, data) {
if (err) throw err;
data = JSON.parse(data); // Convert JSON into an actual JavaScript object
console.log(data.Identificador); // Access object properties with the dot `.` notation
});





share|improve this answer
























  • Thank you for the answer!

    – Manuel Rodriguez
    Nov 22 '18 at 2:13












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422781%2fi-want-to-bring-a-single-value-from-my-json-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Before you can access the actual data inside the string containing JSON, you have to parse it first. Use JSON.parse() for this.



fs.readFile('user.json', function (err, data) {
if (err) throw err;
data = JSON.parse(data); // Convert JSON into an actual JavaScript object
console.log(data.Identificador); // Access object properties with the dot `.` notation
});





share|improve this answer
























  • Thank you for the answer!

    – Manuel Rodriguez
    Nov 22 '18 at 2:13
















1














Before you can access the actual data inside the string containing JSON, you have to parse it first. Use JSON.parse() for this.



fs.readFile('user.json', function (err, data) {
if (err) throw err;
data = JSON.parse(data); // Convert JSON into an actual JavaScript object
console.log(data.Identificador); // Access object properties with the dot `.` notation
});





share|improve this answer
























  • Thank you for the answer!

    – Manuel Rodriguez
    Nov 22 '18 at 2:13














1












1








1







Before you can access the actual data inside the string containing JSON, you have to parse it first. Use JSON.parse() for this.



fs.readFile('user.json', function (err, data) {
if (err) throw err;
data = JSON.parse(data); // Convert JSON into an actual JavaScript object
console.log(data.Identificador); // Access object properties with the dot `.` notation
});





share|improve this answer













Before you can access the actual data inside the string containing JSON, you have to parse it first. Use JSON.parse() for this.



fs.readFile('user.json', function (err, data) {
if (err) throw err;
data = JSON.parse(data); // Convert JSON into an actual JavaScript object
console.log(data.Identificador); // Access object properties with the dot `.` notation
});






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 2:07









BradBrad

117k29239398




117k29239398













  • Thank you for the answer!

    – Manuel Rodriguez
    Nov 22 '18 at 2:13



















  • Thank you for the answer!

    – Manuel Rodriguez
    Nov 22 '18 at 2:13

















Thank you for the answer!

– Manuel Rodriguez
Nov 22 '18 at 2:13





Thank you for the answer!

– Manuel Rodriguez
Nov 22 '18 at 2:13




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422781%2fi-want-to-bring-a-single-value-from-my-json-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







jIbJ PJ9k5w0Ko3zfr6RHyzM6z F5XKiWpNzqlN,nWn5YG4 e1f,x,2w85HUYXuKXUrxXBCJRkRm7
G7X,8HqioZp,umbpW2qlN9F0 hSkYN7W0,zAcM

Popular posts from this blog

How to pass form data using jquery Ajax to insert data in database?

Guess what letter conforming each word

Run scheduled task as local user group (not BUILTIN)