假设我有一个服务器端脚本,它可以通过表上的简单选择生成 JSON。 JSON 在第一个脚本中进行编码。
我无法控制第一个脚本,但我知道底层数据库结构何时发生变化以及 JSON 结构何时发生变化。
脚本 2 使用 CURL 来获取.js
文件(内容)包含 JSON,然后我可以解码为数组。
然后我需要做的是将数据存储在另一个数据库中。
我的问题基本上是关于自动化这个过程,并且当您在数组到达之前不知道数组的结构是什么时,能够从数组创建一个表。
能做到吗?
EDIT添加了当前的 JSON,但重点是它可能会发生变化。
{"name": "Google",
"homepage_url": "http://www.google.com",
"blog_url": "",
"blog_feed_url": "",
"twitter_username": "",
"category_code": "ecommerce",
"tag_list": "retail-portal-online-shopping-markets",
"alias_list": null,
"image": null,
"products":
[],
"relationships":
[],
"competitions":
[],
"providerships":
[{"title": "Legal",
"is_past": false,
"provider":
{"name": "TaylorWessing",
"permalink": "taylorwessing"}}],
"offices":
[{"description": "European HQ",
"address1": "",
"address2": "",
"zip_code": "",
"city": "Brussels",
"state_code": null,
"country_code": "BEL",
"latitude": null,
"longitude": null}]}