How do you display content of a .JSON file using Discord.js?

Currently my code reads out as

if(message.content.startsWith(prefix + 'readback')) {

  fs.readFile('msgs.json', (err, data) => {
    if (err) throw err;
    let _msgs = JSON.parse(data);;

with all appropriate constants and variables

While using prefix + 'readback, the Discord Bot displays _msgs as [object Object] – to make sure it wasn’t an issue with the code, I added console.log(_msgs), and the correct JSON file content displays in the console. Is there a way to get the Bot to display the contents of the JSON file in a channel?

153 thoughts on “How do you display content of a .JSON file using Discord.js?”

  1. I simply couldn’t leave your site prior to suggesting that I extremely enjoyed the standard information an individual supply to your visitors? Is gonna be back continuously in order to investigate cross-check new posts.

  2. Heya are using WordPress for your blog platform? I’m new to the blog world but I’m
    trying to get started and set up my own. Do you require any
    coding expertise to make your own blog? Any help would be really appreciated!

  3. Hello! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me.
    Anyhow, I’m definitely glad I found it and I’ll be
    book-marking and checking back frequently!

  4. It’s really a nice and helpful piece of information. I am happy that you simply shared this useful information with us. Please stay us up to date like this. Thank you for sharing.

  5. hey there and thank you for your info – I’ve definitely picked up anything new from right here.
    I did however expertise several technical points using this
    web site, as I experienced to reload the website a lot of times previous to
    I could get it to load properly. I had been wondering if
    your hosting is OK? Not that I’m complaining, but sluggish loading instances times will sometimes affect your placement in google and could
    damage your high quality score if advertising and
    marketing with Adwords. Well I am adding this RSS to
    my e-mail and can look out for much more of your respective interesting content.

    Ensure that you update this again very soon. cheap flights cheap flights

  6. Hey this is kind of of off topic but I was wanting to know if blogs use WYSIWYG
    editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding skills
    so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  7. Generally I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Thanks, quite nice post.

  8. Simply desire to say your article is as astounding. The clarity to your post is
    just excellent and that i can think you’re a professional in this subject.
    Well together with your permission let me to take hold of your feed to
    keep updated with impending post. Thank you a million and
    please carry on the enjoyable work.

  9. An outstanding share! I’ve just forwarded this onto a friend
    who has been doing a little homework on this. And he actually
    bought me breakfast because I stumbled upon it for him…
    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending time to discuss this subject here on your website.

  10. You actually make it seem so easy with your presentation but I find this matter to be really something which I
    think I would never understand. It seems too complicated
    and very broad for me. I’m looking forward for your next post, I will try to get the hang of it!

  11. Hey there just wanted to give you a quick heads up.
    The text in your post seem to be running off the screen in Internet
    explorer. I’m not sure if this is a format issue or
    something to do with internet browser compatibility but I thought I’d
    post to let you know. The design look great though!
    Hope you get the issue resolved soon. Cheers

  12. A motivating discussion is definitely worth comment. I do think that you ought
    to publish more about this subject matter, it might
    not be a taboo subject but generally folks don’t
    talk about such topics. To the next! Best wishes!!

  13. You can definitely see your skills within the article you write.
    The world hopes for even more passionate writers like you who aren’t
    afraid to say how they believe. At all times follow your heart.

    Stop by my webpage special


Leave a Comment