gpt4 book ai didi

javascript - 将存储在文件中的 json 分配给 js 变量

转载 作者:行者123 更新时间:2023-11-28 21:11:20 26 4
gpt4 key购买 nike

我正在开发一个项目,但我不知道如何做到这一点。我有一个 json 文件,需要将其分配给 js 变量才能使用 protovis 可视化工具。

我尝试在谷歌上搜索,但找不到任何结果。如果有人知道如何做到这一点,请告诉我。谢谢!

最佳答案

使用jQuery's parseJSON() .

Description: Takes a well-formed JSON string and returns the resulting JavaScript object. version added: 1.4.1jQuery.parseJSON( json ) jsonThe JSON string to parse. Passing in a malformed JSON string may result in an exception being thrown.

关于javascript - 将存储在文件中的 json 分配给 js 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8538952/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com