javascript - 如何在我的 React 应用程序上提取 json 段落中的特定句子?

标签 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 know how to just pull that one part of the paragraph"

我想用段落的这一小部分来完成一个网络链接,因此它使用的小句子需要是可变的,并根据json中的artifactID来确定。

如果这可行的话,它会只提取 Json 中段落的一小部分,并将其显示为网站的链接。如果我需要做更多解释,请告诉我。

最佳答案

如果你用子字符串来获取它怎么办?

const myStr = 'Alligator';

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

console.log(myNewStr); // All

关于javascript - 如何在我的 React 应用程序上提取 json 段落中的特定句子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51497442/

相关文章:

html - 使用媒体查询的响应式页脚

javascript - Angular Js ng-repeat无法使用ajax从json数组获取输出

c# - 解析非标准 JSON

Javascript:获取 DELETE 和 PUT 请求

javascript - StandardJs + ES6 扩展类 - 无用的构造函数?

javascript - 如何防止 iPhone(包括 iOS 7)在 HTML 或 JS 中进入休眠状态?

php - 将 JSON 解析为 mySQL

javascript - 全屏时更改 html5 视频控件布局

javascript - 在字符串中查找部分匹配项

php - php 和 POST (html) 之间的执行顺序