编辑json文件时出现问题(错误:第1行上的分析错误:…应为';字符串&';,';数字&';,';空;
我不是一名程序员,而是一名软件翻译。我收到了一份包含一些json文件的工作,我必须编辑这些文件。不幸的是,当我使用SDL Trados的Passollo和任何其他json编辑程序()时,我收到以下错误消息: 错误:第1行的分析错误: 变量开始=[ { ^ 应为'STRING'、'NUMBER'、'NULL'、'TRUE'、'FALSE'、'{'、'[',得到'undefined' 下面的文件运行平稳,但当我试图编辑它们时,它们的语法有错误,解析器会检测到它们编辑json文件时出现问题(错误:第1行上的分析错误:…应为';字符串&';,';数字&';,';空;,json,Json,我不是一名程序员,而是一名软件翻译。我收到了一份包含一些json文件的工作,我必须编辑这些文件。不幸的是,当我使用SDL Trados的Passollo和任何其他json编辑程序()时,我收到以下错误消息: 错误:第1行的分析错误: 变量开始=[ { ^ 应为'STRING'、'NUMBER'、'NULL'、'TRUE'、'FALSE'、'{'、'[',得到'undefined' 下面的文件运行平稳,但当我试图编辑它们时,它们的语法有错误,解析器会检测到它们 var start = [
var start = [
{
type: "top_img",
child: [
{STRING
id:"001",
title:"POD Deck Lite-B1 Service Manual Rev0.0",
href:"../frame_images/A021POD2-COVER-0001.gif"
}
]
},{
type: "menu",
child: [
{
id:"001",
title:"Technology",
description:"Technology"
},{
id:"002",
title:"Service",
description:"Service"
},{
id:"003",
title:"Appendix",
description:"Appendix"
}
]
},{
type: "reference",
child: [
{
id:"001",
title:"How to use",
src:"how to use",
href:"../frame_htmls/how to use.html"
},{
id:"002",
title:"Read me",
src:"readme",
href:"../frame_htmls/readme.html"
},{
id:"003",
title:"Site map",
src:"sitemap",
href:"../frame_htmls/sitemap.html"
},{
id:"004",
title:"History",
src:"history",
href:"../frame_htmls/history.xls"
}
]
},{
type: "header",
child: [
{
id:"001",
title:"Home",
href:"../esm.htm"
},{
id:"002",
title:"Site map",
href:"../frame_htmls/sitemap.html"
}
]
}
];
是否有人可以帮助我解决此错误消息,或根据json解析器规则编辑5个文件,以便允许我将它们编辑为目标语言
问候,
Eduardo Lourenço在id之前有一个不必要的
字符串
确保所有的属性名都用引号括起来。这应该是可行的
[
{
"type":"top_img",
"child":[
{
"id":"001",
"title":"POD Deck Lite-B1 Service Manual Rev0.0",
"href":"../frame_images/A021POD2-COVER-0001.gif"
}
]
},
{
"type":"menu",
"child":[
{
"id":"001",
"title":"Technology",
"description":"Technology"
},
{
"id":"002",
"title":"Service",
"description":"Service"
},
{
"id":"003",
"title":"Appendix",
"description":"Appendix"
}
]
},
{
"type":"reference",
"child":[
{
"id":"001",
"title":"How to use",
"src":"how to use",
"href":"../frame_htmls/how to use.html"
},
{
"id":"002",
"title":"Read me",
"src":"readme",
"href":"../frame_htmls/readme.html"
},
{
"id":"003",
"title":"Site map",
"src":"sitemap",
"href":"../frame_htmls/sitemap.html"
},
{
"id":"004",
"title":"History",
"src":"history",
"href":"../frame_htmls/history.xls"
}
]
},
{
"type":"header",
"child":[
{
"id":"001",
"title":"Home",
"href":"../esm.htm"
},
{
"id":"002",
"title":"Site map",
"href":"../frame_htmls/sitemap.html"
}
]
}
]
函数搜索(源代码){
//log(“我的结果:+source”);
$.ajax({
url:“index.ajax.php”,
类型:“POST”,
cache:false,
数据类型:“json”,
数据:{action:“search”,source:source,form:$(“form#main”).serialize()},
完成:功能(数据){
var d=JSON.stringify(数据);
//桌子
$('table#u data').html(d.table);
$(“输入[name='count']”)val(d.count);
$(“#time”).html(d.time);
console.log(“我的结果:+d”);
//分页
from=Number($(“输入[name='start'])).val();
to=(Number(data.count)>(Number($($input[name='limit']).val())+from))?Number($($input[name='limit']).val())+from:data.count;
如果(data.count==0){
$(“#page_info').html(“未找到结果。”);
$(“#下一步”).hide();
}否则{
$(“#page_info”).html(“显示“+数据中的“+(从+1)+”到“+到+”。总计计数+”记录。”;
$(“#下一步”).show();
}
},
错误:函数(数据){
$(“#表_数据”).html('结果错误。请与管理员联系');
$(“#page_info”).html(“加载错误。”);
}
/*错误:函数(x,e){
如果(x.status==0){
警报('您已脱机!!\n请检查您的网络');
}否则如果(x.status==404){
警报(“未找到请求的URL”);
}否则如果(x.status==500){
警报(“Internel服务器错误”);
}else if(e=='parserrror'){
警报('错误。\n传递JSON请求失败');
}else if(e=='timeout'){
警报(“请求超时”);
}否则{
警报('未知错误。\n'+x.responseText);
}
}*/
});
}
Hi Suresh,感谢您的帮助,但下面所做的更改不起作用。我从json编辑器收到了相同的错误消息。请查看所做的更改。我希望很快收到您的回复。关于这一点,我在上面的代码中也收到了上述错误:错误:第1行的解析错误:函数搜索(sour^应为'STRING','NUMBER','NULL','TRUE','FALSE','{','[',得到'undefined'
function search(source) {
//console.log("My Result: "+source);
$.ajax({
url: "index.ajax.php",
type: "POST",
cache: false,
dataType: "json",
data: { action:"search", source:source, form:$("form#main").serialize() },
complete: function(data) {
var d = JSON.stringify(data);
//table
$('#table_data').html(d.table);
$("input[name='count']").val(d.count);
$("#time").html(d.time);
console.log("My Result: "+ d);
//pagination
from = Number($("input[name='start']").val());
to = (Number(data.count) > (Number($("input[name='limit']").val())+from)) ? Number($("input[name='limit']").val())+from : data.count;
if(data.count == 0) {
$('#page_info').html('<p>No results found.</p>');
$('#next').hide();
} else {
$('#page_info').html('<p>Showing '+(from+1)+' to '+to+' of '+data.count+' records in total.</p>');
$('#next').show();
}
},
error: function(data) {
$('#table_data').html('<tr><td colspan="20">Results error. Please contact admin.</td><tr>');
$("#page_info").html("<p>Load error.</p>");
}
/* error:function(x,e) {
if (x.status==0) {
alert('You are offline!!\n Please Check Your Network.');
} else if(x.status==404) {
alert('Requested URL not found.');
} else if(x.status==500) {
alert('Internel Server Error.');
} else if(e=='parsererror') {
alert('Error.\nParsing JSON Request failed.');
} else if(e=='timeout'){
alert('Request Time out.');
} else {
alert('Unknown Error.\n'+x.responseText);
}
}*/
});
}