gpt4 book ai didi

json - 从Github页面提供JSON数据

转载 作者:行者123 更新时间:2023-12-04 01:48:37 24 4
gpt4 key购买 nike

我在github上有一个存储库,该存储库的根目录中包含许多csv,json,yml数据文件。

如何使用Github Pages来提供这些文件?

例如:当我转到http://username.github.io/reponame/


/posts-提供posts.json文件的内容
/users-提供users.json文件的内容
/comments-提供comment.json文件的内容
/posts.csv-提供posts.csv文件的内容

最佳答案

您只需要在存储库中添加.json文件,就可以像普通的JSON API一样访问它们

在以下存储库username.github.io/reponame中添加以下文件

posts.json

[
{"id": 1, "title": "Title 1"},
{"id": 2, "title": "Title 2"}
]


users.json

[
{"name": "abc", "email": "abc@example.com"},
{"name": "xyz", "email": "xyz@example.com"}
]


comments.json

[
{"post_id": "1", "text": "Comment 1"},
{"post_id": "2", "text": "Comment 2"}
]


posts.csv

id,title
1,Title 1
2,Title 2


并使用


http://username.github.io/reponame/posts.json
http://username.github.io/reponame/users.json
http://username.github.io/reponame/comments.json
http://username.github.io/reponame/posts.csv

关于json - 从Github页面提供JSON数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39199042/

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