1

I have used web3js by using it in the form of node(npm). But I don't know how to extract some data generated from nodes.

Does anyone know this web3js so the results can be changed to json form? Because I need this so that the data generated can be entered into the variable, so that I can then process the variable into the program.

Like let's say I use the web3-eth-accounts package as follows (use node with cmd) :

var Accounts = require('web3-eth-accounts')
var accounts = new Accounts('https://rinkeby.infura.io/')
accounts.create()

Example result from node : enter image description here

Well, for the above does anyone know to be converted into json form?

1
  • The question is not related to Ethereum or web3js, it is javascript coding question.
    – Aquila
    Commented Oct 8, 2018 at 22:01

1 Answer 1

0
var Accounts = require('web3-eth-accounts')
var accounts = new Accounts('https://rinkeby.infura.io/')
var account = accounts.create()

console.log(account.address, account.privateKey)
1
  • Wow thank you for your info, that means a lot to me.
    – Zoro Raka
    Commented Oct 9, 2018 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.