question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON from .js files?

See original GitHub issue
"extension": ".js"

Any example to use .js files instead of .json files?

Following code do nothing:

module.exports = {
	'Hello': 'سلام'
};

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
boxsnakecommented, Aug 20, 2018

No exports. Please do not think this is a true Javascript file. It is indeed a JSON file with .js extension.

{
	"Hello": "سلام"
}

That’s all. Notes about JSON format:

  • Use double quotes for both keys and string values
  • No comma(s) at the end of last line
  • No comments permitted
0reactions
mashpiecommented, Aug 18, 2020

The staticCatalog option might also be useful for your use case https://github.com/mashpie/i18n-node#some-words-on-staticcatalog-option

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Read a JSON File in JavaScript
One standard method we can use to read a JSON file (either a local file or one uploaded to a server) is with...
Read more >
How to read an external local JSON file in JavaScript?
28 Answers 28 · Mention the path of the json file in the script source along with the javascript file <script type="text/javascript" src="data.json"></script>...
Read more >
Working with JSON - Learn web development | MDN
JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax.
Read more >
Read/Write JSON Files with Node.js | by Osio Labs
Passing require() with the path to a JSON file will synchronously read and parse the data into a JavaScript object. const config =...
Read more >
How to read an external JSON file in JavaScript
How to read an external JSON file in JavaScript · Method 1: Using require module (NodeJS environment only) · Example · Method 2:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found