English 中文(简体)
• 如何在斯诺弗凯读JSON?
原标题:How to read JSON in Snowflake?
  • 时间:2023-08-11 18:11:18
  •  标签:
  • json

将JSON的档案转换成一栏,但一栏Im无法读到,其价值并不大。

CREATE OR REPLACE TEMPORARY TABLE SAMPLE_J
(
SAMPLE_JSON VARCHAR(100)
);

INSERT INTO SAMPLE_J
(SAMPLE_JSON)
VALUES ( 页: 1"ident":["Product:Tires","sender_id:12345","sender_name:John Who","Tire_Condition:New"注iii 

--this is my query
SELECT 
   SAMPLE_JSON,
   JSON_EXTRACT_PATH_TEXT(SAMPLE_JSON, Product ) as test1,
   JSON_EXTRACT_PATH_TEXT(SAMPLE_JSON, Product[0注.Product ) as test2
FROM SAMPLE_J;

the result is null for test 1 and test 2

这就是JSON档案如何看待:

页: 1

“身份”:

"Product:Tires",

"sender_id:12345",

"sender_name:John Who",

"Tire_Condition:New"

iii

问题回答

您在此是关键<代码> 识别内的一个阵列。

with data as (
    select $1 as j
    from VALUES ( {"ident":["Product:Tires","sender_id:12345","sender_name:John Who","Tire_Condition:New"]} ) 
)

select j
    , json_extract_path_text(j,  ident ) j_ident
    , json_extract_path_text(j,  ident[0] ) j_ident0
from data;

<代码>j_ident0是该阵列的第一个要素,其价值为。 产品:Tires。 这并不是一位神职人员,只是一个扼杀。





相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签