I've created translation file, validated it at jsonlint, ensured the translation file was located at /locales/translation-en.json.
I consistently get the error,
There is a typo in: locales/translation-en.json
I'm stumped ... here's the translation json I have.
{
"tab":{
"legionella":"LEGIONELLA",
"logbook":"LOGBOOK"
},
"representative":{
"tag":"Representative: __rep__ — Phone: __phone__ — ",
"email":"Click here to email your rep"
},
"portlet":{
"contacts":{
"title":"Contacts",
"type":"Contact<br>Type",
"name":"Contact<br>Name",
"phone":"Phone<br>Number",
"type_context_1":"Owner",
"type_context_2":"Maintenance",
"type_context_3":"Other"
},
"samples":{
"title":"Legionella Samples",
"sampleDate":"Sample<br>Date",
"transmitForm":"Transmittal<br>Form",
"certOfAnalysis":"Certificate<br>of Analysis",
"concentration":"Concentration<br>(UFC/L)",
"correctAction":"Corrective<br>Action",
"range_context_1":"Interference",
"range_context_2":"Less than 10,000 UFC/L",
"range_context_3":"Between 10,000 to 1,000,000 UFC/L",
"range_context_4":"Greater than 1,000,000 UFC/L"
},
"serviceReports":{
"title":"Service Reports",
"date":"Report<br>Date"
},
"maintenance":{
"title":"Maintenance Programs",
"popup":"Create New Maintenance Program",
"type":"Program<br>Type",
"date":"Effective<br>Date",
"document":"Program<br>Document",
"type_context_1":"Water Treatment",
"type_context_2":"Mechanical",
"type_context_3":"Schematic",
"type_context_4":"O&M Manual",
"popup_type":"Type",
"popup_date":"Effective Date",
"popup_document":"Document",
"popup_save":"Save Maintenance Program"
},
"history":{
"title":"System History",
"popup":"Create New System History Entry",
"date":"Event<br>Date",
"type":"Event<br>Type",
"details":"Event<br>Details",
"type_context_1":"Breakage",
"type_context_2":"Repair",
"type_context_3":"Decontamination",
"type_context_4":"Replacement"
},
"reminders":{
"title":"Reminders",
"date":"Date",
"description":"Description"
},
"emails":{
"title":"Emails",
"date":"Date",
"subject":"Subject",
"recipient":"Recipient"
}
},
"common":{
"view":"View",
"registryList":"Registry: ",
"signout":"Sign Out"
}
}
So, I found the issue. I didn't give ALL the details required in the original question. What I failed to let everyone know was that the json file resided in Netsuite. Netsuite doesn't like serving up .json files. When I converted it to .json.txt, all was well in the world. Thanks!
Just in the event someone missed the obvious..
JSON, unlike Javascipt, requires the keys be quoted.
Valid JSON:
{ "foo": "bar" }
Invalid JSON:
{ foo: "bar" }
Since this question pops high in Google when search for "i18next there is a typo in", here's what you can do.
Use a JSON validation tool. If it's not valid, correct your mistakes and try again.
Related
EDIT
Not sure what to do because I realized the question I originally asked was irrelevant to what I really wanted, because I thought the descriptionurl and shortdescriptionurl from a Wikipedia API query of an image file would return text that described the image, but really they're just descriptions of the URL, so I feel dumb about that.
I tried to delete the question but it wouldn't let me, because there's already an answer.
So I'm going to change the question to what I really want to know, but now the answer that already exists will not make any sense, so this is kind of a mess but I don't know what to do about it.
What I actually wanted to know
When I do this:
https://en.wikipedia.org/w/api.php?action=query&pageids=18306940&prop=revisions&formatversion=2&rvprop=content
I get this:
{
"batchcomplete": true,
"query": {
"pages": [
{
"pageid": 18306940,
"ns": 6,
"title": "File:Rot-Weiss Essen Fans, May 2008.jpg",
"revisions": [
{
"contentformat": "text/x-wiki",
"contentmodel": "wikitext",
"content": "== Summary ==\n{{Information\n|Description=Fans of Rot-Weiss Essen are celebrating a 1-0 away victory against 1. FC Magdeburg in the 2007/08 Regionalliga Nord.\n|Source=I created this work entirely by myself.\n|Date=May 24, 2008\n|Author=[[User:Povldr|Povldr]] ([[User talk:Povldr|talk]])\n|other_versions=\n}}\n== Licensing: ==\n{{self|cc-by-sa-3.0|GFDL}}\n\n{{Copy to Wikimedia Commons|bot=Fbot|priority=true}}"
}
]
}
]
}
}
What I'd like to do is have the query return only these parts of the content:
Fans of Rot-Weiss Essen are celebrating a 1-0 away victory against 1. FC Magdeburg in the 2007/08 Regionalliga Nord. (the Description)
May 24, 2008 (the Date)
Poldvr (the Author)
I could just get all that out of the content string by chopping up the string in C#, but is there any way to get it spit back to me formatted as nice little JSON in the first place?
I haven't been able to figure this out from The Wikipedia API page on the parse action, nor from the Wikipedia API Sandbox.
Can it be done?
Here is the old question, which was asking the wrong thing
title was: Wikipedia API: how do I use descriptionurl and shortdescriptionurl?
When I do this, for example:
https://en.wikipedia.org/w/api.php?action=query&list=allimages&aiprop=url&date&format=json&ailimit=1&aifrom=rot
...one of the pieces of JSON info is called "descriptionurl," and another is "shortdescriptionurl."
When I type those urls into a browser, it just takes me to the image's entire page.
How do I use those urls to get just the text of the actual description and short description?
Oh, and before you just type the link to the Wikipedia API, I have been trying to find out this information on there and failing. It's full of general information but I can't find this specific thing.
When I put your URL in a browser, I get some nice JSON as expected:
{
"warnings": {
"main": {
"*": "Unrecognized parameter: date."
}
},
"batchcomplete": "",
"continue": {
"aicontinue": "Rot-Weiss_Essen_logo.svg",
"continue": "-||"
},
"query": {
"allimages": [{
"name": "Rot-Weiss_Essen_Fans,_May_2008.jpg",
"url": "https://upload.wikimedia.org/wikipedia/en/5/5c/Rot-Weiss_Essen_Fans%2C_May_2008.jpg",
"descriptionurl": "https://en.wikipedia.org/wiki/File:Rot-Weiss_Essen_Fans,_May_2008.jpg",
"descriptionshorturl": "https://en.wikipedia.org/w/index.php?curid=18306940",
"ns": 6,
"title": "File:Rot-Weiss Essen Fans, May 2008.jpg"
}]
}
}
To extract an individual entry, you'll need to parse the JSON with your programming language of choice.
I have a problem with my chatfuel JSON API from my node JS app.
I try to catch an error and return a message + a redirect_to_block to be able to ask the user again.
My error detection works well and if I try to display a message only it works. My JSON is :
[{"text":"Please type again"}]
But I can't add a redirect_to_blocks to this (and I even loose the text message display).
I tried those solutions (and probably some more) but I think I didn't get the JSON structure :
// Solution 1
[{ "message": { "text": "Please type again" }, "redirect_to_blocks": ["When?"] }]
// Solution 2
[{ "messages": { "text": "Please type again" }, "block_names": ["When?"], "type": "show_block", "title": "go" }]
// Solution 3
[{ "text": "Please type again" }, "redirect_to_blocks": ["When?"] }]
And here is the block I want to add (i'm not even sure the name I have to give to the JSON)
Thanks !
Julian, workaround that works for me is returning from API following JSON:
{
"set_attributes": {
"redirectBlock": <your block name>
}
}
and build structure in Chatfuel as below:
Chatfuel flow
Now you have a dispatcher that allows you to map values from API to block titles.
I had your same issues,
I created a json request in my Flow that returns this json:
{ "redirect_to_blocks": ["Block name"] }
but Chatfuel never redirects to it.
I solved it creating a new block in "Automate" pane with same name and It works.
I know that it's passed much time since your question,
but I hope it can helps future issues.
I'm trying to import my JSON file into my Firebase but it keeps giving me this error. I don't know why this JSON file isn't allowed to be imported into since JSONLint says it's a valid JSON file.
Here's the file:
{
"Featured" : {
"artist" : "james turell",
"artistEPK" : "artistsownepk.pdf",
"author" : "john queue author",
"date" : "7/28/2016",
"fullScreenImg" : "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687",
"linksToMedia" : [ "www.wallplay.com/project-name/james-t/press.html" ],
"linksToPress" : [ "" ],
"location" : "10 Main Street",
"mainImg" : "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687",
"pressImgs" : [ "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687" ],
"pressRelease" : "projectpressrelease.pdf",
"projectImgs" : [ "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687" ],
"projectSubheader" : "subheader of project",
"projectTitle" : "title of project",
"projectURL" : "",
"soundFile" : [ ],
"text" : "here there would be a text for james turell",
"videoURL" : ""
},
"Future" : {
},
"Past" : {
},
"Present" : {
}
}
the issue happens when importing json using the web interface
I just spent some time on this and found the issue for me (and likely for many others) when getting this error message. It looks like firebase can only import files with UTF-8 encoding (no BOM)
I found it strange, as I couldn't re-import the content I had just exported.
I tried all UTF versions 8, 16 with LE and BE with and without BOM, only UTF-8 works
I wish firebase did not have this utterly misleading error message
Two things that might help someone else save a couple of hours of head scratching:
1) Empty strings are valid JSON keys, they're NOT valid Firebase keys.
2) While the web tool error message is horrible, the command-line tool actually provides useful information like, say, a line number (nice when you have a 300K+ line file)
E.g.
firebase --project database:set / import.json
to overwrite everything from the root
This happened to me, and had a totally different cause: I had Firebase functions that triggered when data is added to certain collections. The GUI tool gave me the unhelpful error the OP got. But running with the CLI, I got:
Error: HTTP Error: 400, This request would cause too many functions to be triggered.
So, the error ended up really saving my hide since running a function for each of the few hundred nodes I was importing would have been disastrous.
To solve the issue, I deployed my app code with the functions commented out and then was able to use the GUI to import my data. Once my data was in, I un-commented out the functions and deployed again.
My filename was "something-somethingelse", ie it had a '-' character in the filename. Changing it to 'something.json' solved the problem
So, don't have any special characters in your filenames.
The JSON you posted is valid for Firebase, so the issue is not with this JSON. It must be somewhere else in your application.
if you created triggered function a lot of. You have to remove triggered functions. Next try again. That way works for me.
I just found one more reason when Firebase throws this error:
This was the data firebase refused to upload:
{
"S. No.": 2,
"University Name": "Acharya Nagarjuna University, Guntur (Id: U-0003)",
"College Name": "Abhinav Institute of Management & Technology (Id: C-39450)",
"College Type": "Affiliated College",
"State Name": "Andhra Pradesh",
"District Name": "Prakasam"
}
I thought of changing the key name of "S. No." and it worked.
{
"S": 2,
"University Name": "Acharya Nagarjuna University, Guntur (Id: U-0003)",
"College Name": "Abhinav Institute of Management & Technology (Id: C-39450)",
"College Type": "Affiliated College",
"State Name": "Andhra Pradesh",
"District Name": "Prakasam"
}
The Firebase was accepting the later format (I believe the problem was with .(dot) followed by space.)
I hope this helps!!!
This was happening for me as well, as a web developer, I looked into the Developers Console and the actual error was because of authentication that Firebase's console was not able to authenticate while validating the JSON files.
So I did a "refresh" of the web page and it worked.
I have a similar problem with JSON containing huge data. I solved this problem by using firebase import tool. It has options for imports to specific nodes etc.
Here is a JSON instance showing the start-time and end-time for a meeting:
{
"start time": "2015-02-19T08:00:00Z",
"end time": "2015-02-19T09:00:00Z"
}
I can specify the structure of that instance using JSON Schema: the instance must contain an object with a "start time" property and an "end time" property and each property must be a date-time formatted string. See below for the JSON schema. But what I cannot specify is this: the meeting must start before it ends. That is, the value of "start time" must be less than the value of "end time". Some people call this data dependency a co-constraint. In the XML world there is a wonderful, simple technology for expressing co-constraints: Schematron. I am wondering if there is an equivalent technology in the JSON world? What would you use to declaratively describe the relationship between the value of "start time" and "end time"? (Note: writing code in some programming language is not what I mean by "declaratively describe the relationships". I am seeking a declarative means to describe the data dependencies that are present in JSON documents, not procedural code.)
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"meeting": {
"type": "object",
"properties": {
"start time": { "type": "string", "format": "date-time"},
"end time": { "type": "string", "format": "date-time"}
},
"required": [ "start time", "end time" ],
"additionalProperties": false
}
},
"$ref": "#/definitions/meeting"
}
Yes.There is a JSON Semantic Validator based on Schematron available at:
https://www.npmjs.com/package/jsontron
It implements 'schema', 'phase', 'rule', 'assert' and reporting features of Schematron.
Here is when the original example of start time and end time was run through the validator:
good_time.json file contents:
{
"starttime": "2015-02-19T08:00:00Z",
"endtime": "2015-02-19T09:00:00Z"
}
bad_time.json file contents:
{
"starttime": "2015-02-19T09:00:00Z",
"endtime": "2015-02-19T08:00:00Z"
}
Schematron Rules file meeting-times-rules.json snippet:
"rule":[
{
"context": "$",
"assert":[
{
"id":"start_stop_meeting_chec",
"test":"jp.query(contextNode, '$..starttime') < jp.query(contextNode, '$..endtime')",
"message": "Meeting cannot end before it starts"
}
]
}
]
When ran with correct example:
$jsontron\bin>node JSONValidator -i ./good_time.json -r ./meeting-times-rules.json
The output was:
Starting Semantic Validation .........
Parsing Pattern: Meetingtimings
1 Pattern(s) Requested. 1 Pattern(s) Processed. 0 Pattern(s) Ignored.
**** THIS INSTANCE IS SEMANTICALLY VALID ****
Completed Semantic Validation .........
When ran with bad data example. The output was:
$jsontron\bin>node JSONValidator -i ./bad_time.json -r ./meeting-times-rules.json
Starting Semantic Validation .........
Parsing Pattern: Meetingtimings
1 Pattern(s) Requested. 1 Pattern(s) Processed. 0 Pattern(s) Ignored.
**** THIS INSTANCE CONTAINS SEMANTIC VALIDATION ISSUES. PLEASE SEE FULL REPORT BY ENABLING DEBUG WITH -d OPTION ****
Completed Semantic Validation .........
The message with debug options was:
...validation failed...
message: 'Meeting cannot end before it starts'
Sadly, the answer is no. JSON Schema allows you to validate the structure, and permitted values, but there are no mechanisms for validating sets of values, a'la Schematron.
The simplest way to solve this is to have another script in the pipeline which runs these kinds of checks.
There is an implementation in Oxygen JSON Editor that allows you to validate JSON documents against Schematron.
https://www.oxygenxml.com/doc/versions/22.0/ug-editor/topics/json-validating-documents-against-schema.html
The Schematron rules are expressed using XPath expressions, and the problems are reported in the JSON documents.
<!-- The 'genre' property should be none but one of the items declared in 'literatureGenres' property -->
<sch:rule context="genre">
<sch:let name="genre" value="text()"/>
<sch:let name="literatureGenres" value="//literatureGenres/text()"/>
<sch:assert test="normalize-space($genre) = $literatureGenres">
Wrong genre: '<sch:value-of select="$genre"/>'. See the 'literatureGenres' property for the permitted ones.
</sch:assert>
</sch:rule>
https://www.slideshare.net/nottavy/schematron-for-nonxml-languages
The json-schema.org website lists quite a few implementations.
I find this kinda strange. it works on older versions of iQuery (ie 1.2.x to 1.3). However, i am getting a parserror when using jQuery 1.4.x
Any help will be appreciated. Thank you.
This is what i get from XMLHttpRequest.responseText
({count: 5, success: true, error: '', cache: false, data: [{column: ['Mike','Mike','Steve','Steve','Steve']}]})
Jquery 1.4 updated their JSON parser, so that it no longer accepts invalid JSON that it did before. Your server is outputting invalid JSON that was previously tolerated, but no longer is. This change was mentioned (briefly) in the release notes and documentation, and there's been lots of discussion about it if you google "jquery 1.4 JSON"
But to sum up: the keys in JSON, to be valid, must have quotes around them, the string can't be surrounded by those parentheses, and nothing can use single quotes as delimiters, so your JSON would need to be:
{"count": 5, "success": true, "error": "", "cache": false, "data": [{"column": ["Mike","Mike","Steve","Steve","Steve"]}]}
or, more readably:
{
"count": 5,
"success": true,
"error": "",
"cache": false,
"data": [
{
"column": [
"Mike",
"Mike",
"Steve",
"Steve",
"Steve"
]
}
]
}
The specs are very nicely and clearly spelled out at http://www.json.org/ with pictures and diagrams. You can also check your JSON at JSONLint - the JSON above checks out there just fine, but your original JSON raises all kinds of errors.
So as to what you need to do: if you have the ability to change what your server sends out, do that - make it output valid JSON. Please. Only if you are unable to change the server's behavior, you'll have to use a workaround from one of the posts linked above, or use some other JSON library.
General principle: in all cases, doing it the Right Way™ is preferable - fixing the server's output (even if that's filing a bug on an external server/API) is the long-term solution, but may not be immediately practical. So hackish workarounds are sometimes necessary, but not optimal.