1
私は以下のようなテキストファイルから従業員の詳細を読んでいます。私のような結果物を必要とし、この応答から今テキストファイルを読み込み、特定の形式のJSONに変換する
Mark
Mark have 10 years of experience working with youth agencies. Mark have a bachelor’s degree in outdoor education. He raise money, train leaders, and organize units. He have raised over $100,000 each of the last six years. He consider himself a good public speaker, and have a good sense of humor.
Jennifer
Jennifer enjoy meeting new people and finding ways to help them have an uplifting experience. She have had a variety of customer service opportunities, through which she was able to have fewer returned products and increased repeat customers, when compared with co-workers. She is dedicated, outgoing, and a team player.
:
$(document).ready(function() {
$.ajax({
url: "employees.txt",
success:function(response) {
console.log(response);
}
});
});
は、それは私のような応答を与える
var employees = [
["mark", {
"name": "Mark",
"description": "Mark have 10 years of experience working with youth agencies. Mark have a bachelor’s degree in outdoor education. He raise money, train leaders, and organize units. He have raised over $100,000 each of the last six years. He consider himself a good public speaker, and have a good sense of humor."
}],
["jennifer", {
"name": "Jennifer",
"description": "Jennifer enjoy meeting new people and finding ways to help them have an uplifting experience. She have had a variety of customer service opportunities, through which she was able to have fewer returned products and increased repeat customers, when compared with co-workers. She is dedicated, outgoing, and a team player."
}]
];
私はこれをどのように行うことができますか?誰も私にこれを手伝ってもらえますか?前もって感謝します。
によって、我々はそれを分割することができますブロックを返す期待される結果は有効なJSONではありません。 –
したがって、すべての行の後にリターン文字(\ rまたは\ n?)があり、すべてのレコードの後に2つの改行がありますか? – gurvinder372
@Jenz - なぜ\ nや\ rの文字で表示しましたか?表示された応答ファイルの一方または両方が含まれています。 – enhzflep