Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在react应用程序上提取json中段落内的特定句子?_Javascript_Html_Json_Reactjs - Fatal编程技术网

Javascript 如何在react应用程序上提取json中段落内的特定句子?

Javascript 如何在react应用程序上提取json中段落内的特定句子?,javascript,html,json,reactjs,Javascript,Html,Json,Reactjs,我想在react应用程序的Json中提取一个段落中的特定句子。比如说- groupinfo: this is the groups info errorInfo: "imagine this is a long paragraph within a Json file, and i want to display/pull just a small part of it. so for instance i want just (long paragraph) and I want to kno

我想在react应用程序的Json中提取一个段落中的特定句子。比如说-

groupinfo: this is the groups info
errorInfo: "imagine this is a long paragraph within a Json file, and i want to display/pull just a small part of it. so for instance i want just (long paragraph) and I want to know how to just pull that one part of the paragraph"
我想用段落的这一小部分来完成一个weblink,因此它使用的小句子需要是可变的,并根据json中的artifactID来确定


那么,如果这是可行的,它将只提取Json中段落的一小部分,并将其显示为指向网站的链接。如果我需要做更多的解释,让我知道。

如果你用子字符串得到它怎么办

const myStr = 'Alligator';

const myNewStr = myStr.substring(0, 3);

console.log(myNewStr); // All