T-SQL: How Can I Parse a JSON Array and Extract a Single Property Value?

Jim G.

Given that:

SELECT * FROM OPENJSON(JSON_QUERY('[{"JobId":"2838","Options":1}, {"JobId":"2839","Options":1}]'))

Gives us:

key value                           type
0   {"JobId":"2838","Options":1}    5
1   {"JobId":"2839","Options":1}    5

How can I change my query to return the job ids?

value
2838
2839
squillman

This should do it

SELECT JobId
FROM OPENJSON('[{"JobId":"2838","Options":1}, {"JobId":"2839","Options":1}]')
WITH (JobId INT N'$.JobId');

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to extract JSON value in strangely formatted array?

分類Dev

How can you extract a nested JSON value?

分類Dev

How can I validate JSON array value in postman?

分類Dev

How can I parse a java property file with php?

分類Dev

How can I check if the array of objects has duplicate property values and get the last value that is repeated?

分類Dev

How can I get the index of an object in an array with a property value that matches a specific criteria?

分類Dev

How can I create empty array node using boost property_tree of json parser

分類Dev

Can I use JavaScript JSON.parse with an external array?

分類Dev

How do I parse an array inside parsed JSON in Swift?

分類Dev

How can I get the key name and its value from an array within a JSON object

分類Dev

How can I get a specific value from my JSON object without using Array.filter()?

分類Dev

Kotlin: How can I reduce child arrays into a single array?

分類Dev

How can I subtract an array from a single data frame column?

分類Dev

How I can modify a property value of collection in Laravel?

分類Dev

How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET

分類Dev

How can I suppress column header output for a single SQL statement?

分類Dev

How to extract a property from array of objects and slice it?

分類Dev

How to parse the json array in golang?

分類Dev

How to parse json array with ajax?

分類Dev

How can I automap an object with a JSON property to an object without a JSON property?

分類Dev

How can I compare a loop value to an array value that is not sequentially the same?

分類Dev

How can I group by distinct value into a (value,count) array in clickhouse?

分類Dev

I can't assign a value to a 2d array

分類Dev

Talend Extract Json String As Key value Array

分類Dev

How do I write-host a single property of an element in a powershell array?

分類Dev

Android: How to parse JSON Array of Array of objects

分類Dev

Can not extract value in SOAPUI property transfer using xPath and namespaces

分類Dev

How do I parse a JSON which contains an array inside a json Object without a arrayName

分類Dev

Why can't I parse YAML with Ruby?

Related 関連記事

  1. 1

    How to extract JSON value in strangely formatted array?

  2. 2

    How can you extract a nested JSON value?

  3. 3

    How can I validate JSON array value in postman?

  4. 4

    How can I parse a java property file with php?

  5. 5

    How can I check if the array of objects has duplicate property values and get the last value that is repeated?

  6. 6

    How can I get the index of an object in an array with a property value that matches a specific criteria?

  7. 7

    How can I create empty array node using boost property_tree of json parser

  8. 8

    Can I use JavaScript JSON.parse with an external array?

  9. 9

    How do I parse an array inside parsed JSON in Swift?

  10. 10

    How can I get the key name and its value from an array within a JSON object

  11. 11

    How can I get a specific value from my JSON object without using Array.filter()?

  12. 12

    Kotlin: How can I reduce child arrays into a single array?

  13. 13

    How can I subtract an array from a single data frame column?

  14. 14

    How I can modify a property value of collection in Laravel?

  15. 15

    How can I use SQL Server JSON_VALUE function in EF 6 Code First for classic .NET

  16. 16

    How can I suppress column header output for a single SQL statement?

  17. 17

    How to extract a property from array of objects and slice it?

  18. 18

    How to parse the json array in golang?

  19. 19

    How to parse json array with ajax?

  20. 20

    How can I automap an object with a JSON property to an object without a JSON property?

  21. 21

    How can I compare a loop value to an array value that is not sequentially the same?

  22. 22

    How can I group by distinct value into a (value,count) array in clickhouse?

  23. 23

    I can't assign a value to a 2d array

  24. 24

    Talend Extract Json String As Key value Array

  25. 25

    How do I write-host a single property of an element in a powershell array?

  26. 26

    Android: How to parse JSON Array of Array of objects

  27. 27

    Can not extract value in SOAPUI property transfer using xPath and namespaces

  28. 28

    How do I parse a JSON which contains an array inside a json Object without a arrayName

  29. 29

    Why can't I parse YAML with Ruby?

ホットタグ

アーカイブ