Flatten a nested JSON? [duplicate] - json

This question already has answers here:
How to flatten a nested JSON recursively, with flatten_json
(1 answer)
Python Pandas - Flatten Nested JSON
(1 answer)
Closed 9 months ago.
I am trying to flatten the following JSON and flatten it hierarchically:
https://justpaste.it/6e60p
I am using pandas json_normalize function to do this but I am bit stuck.
pd.json_normalize(test_json['result'])
Gives me 2 columns with nested dicts.
I am trying to use record_path=['userDetails'] but then it opens only the user part.
Please advise what is the best practice to flatten the JSON hierarchically?
test_json = {
"success": True,
"error": 'null',
"errorObject": None,
"result": [
{
"requestId": 45,
"userIds": [
4
],
"userDetails": [
{
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
],
"requestColumnGrants": [
{
"id": 57,
"creationTime": 1652083406187,
"lastUpdateTime": 1652083407853,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 1,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "nationkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "nationkey",
"description": None,
"tags": [
{
"id": 1,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "pii",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 0,
"ordinalOverride": None
},
"operationType": "FULL_MASKING",
"operationPayload": "{\"letter\":\"*\"}",
"policyRecommendedOperationType": "FULL_MASKING",
"policyRecommendedOperationPayload": "{\"letter\":\"*\"}",
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 56,
"creationTime": 1652083406165,
"lastUpdateTime": 1652083406165,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 2,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "name",
"rawType": "STRING",
"type": "UNKNOWN",
"trinoName": "name",
"description": None,
"tags": [
{
"id": 2,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "first_name",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 1,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 55,
"creationTime": 1652083406141,
"lastUpdateTime": 1652083406141,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 3,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "regionkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "regionkey",
"description": None,
"tags": [
{
"id": 5,
"creationTime": 1652080042000,
"lastUpdateTime": 1652080042000,
"name": "region",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 2,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
}
],
"workflowValues": [
{
"requestId": 45,
"requestWorkflowProgressionId": 106,
"name": "f3624cb8-cebd-4608-9d9a-60c5b21adbd3.firstName",
"value": "dcasd",
"type": "String",
"source": "Form",
"id": 1,
"creationTime": 1652083422000,
"lastUpdateTime": 1652083422000
},
{
"requestId": 45,
"requestWorkflowProgressionId": 106,
"name": "f3624cb8-cebd-4608-9d9a-60c5b21adbd3.lastNam",
"value": "dsadw",
"type": "String",
"source": "Form",
"id": 2,
"creationTime": 1652083422000,
"lastUpdateTime": 1652083422000
}
]
},
{
"requestId": 44,
"userIds": [
4
],
"userDetails": [
{
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
],
"requestColumnGrants": [
{
"id": 54,
"creationTime": 1652082684949,
"lastUpdateTime": 1652082686821,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 1,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "nationkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "nationkey",
"description": None,
"tags": [
{
"id": 1,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "pii",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 0,
"ordinalOverride": None
},
"operationType": "FULL_MASKING",
"operationPayload": "{\"letter\":\"*\"}",
"policyRecommendedOperationType": "FULL_MASKING",
"policyRecommendedOperationPayload": "{\"letter\":\"*\"}",
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 53,
"creationTime": 1652082684927,
"lastUpdateTime": 1652082684927,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 2,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "name",
"rawType": "STRING",
"type": "UNKNOWN",
"trinoName": "name",
"description": None,
"tags": [
{
"id": 2,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "first_name",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 1,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 52,
"creationTime": 1652082684905,
"lastUpdateTime": 1652082684905,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 3,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "regionkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "regionkey",
"description": None,
"tags": [
{
"id": 5,
"creationTime": 1652080042000,
"lastUpdateTime": 1652080042000,
"name": "region",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 2,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
}
],
"workflowValues": []
},
{
"requestId": 40,
"userIds": [
4
],
"userDetails": [
{
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
],
"requestColumnGrants": [
{
"id": 42,
"creationTime": 1651412063835,
"lastUpdateTime": 1651412065727,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 1,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "nationkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "nationkey",
"description": None,
"tags": [
{
"id": 1,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "pii",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 0,
"ordinalOverride": None
},
"operationType": "FULL_MASKING",
"operationPayload": "{\"letter\":\"*\"}",
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 41,
"creationTime": 1651412063807,
"lastUpdateTime": 1651412063807,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 2,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "name",
"rawType": "STRING",
"type": "UNKNOWN",
"trinoName": "name",
"description": None,
"tags": [
{
"id": 2,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "first_name",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 1,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 40,
"creationTime": 1651412063779,
"lastUpdateTime": 1651412063779,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 3,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "regionkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "regionkey",
"description": None,
"tags": [
{
"id": 5,
"creationTime": 1652080042000,
"lastUpdateTime": 1652080042000,
"name": "region",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 2,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
}
],
"workflowValues": []
},
{
"requestId": 39,
"userIds": [
4
],
"userDetails": [
{
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
],
"requestColumnGrants": [
{
"id": 39,
"creationTime": 1651411857024,
"lastUpdateTime": 1651411858669,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 1,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "nationkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "nationkey",
"description": None,
"tags": [
{
"id": 1,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "pii",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 0,
"ordinalOverride": None
},
"operationType": "FULL_MASKING",
"operationPayload": "{\"letter\":\"*\"}",
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 38,
"creationTime": 1651411856994,
"lastUpdateTime": 1651411856994,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 2,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "name",
"rawType": "STRING",
"type": "UNKNOWN",
"trinoName": "name",
"description": None,
"tags": [
{
"id": 2,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "first_name",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 1,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 37,
"creationTime": 1651411856970,
"lastUpdateTime": 1651411856970,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 3,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "regionkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "regionkey",
"description": None,
"tags": [
{
"id": 5,
"creationTime": 1652080042000,
"lastUpdateTime": 1652080042000,
"name": "region",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 2,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
}
],
"workflowValues": []
},
{
"requestId": 38,
"userIds": [
4
],
"userDetails": [
{
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
],
"requestColumnGrants": [
{
"id": 36,
"creationTime": 1651411738066,
"lastUpdateTime": 1651411739933,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 1,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "nationkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "nationkey",
"description": None,
"tags": [
{
"id": 1,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "pii",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 0,
"ordinalOverride": None
},
"operationType": "FULL_MASKING",
"operationPayload": "{\"letter\":\"*\"}",
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 35,
"creationTime": 1651411738036,
"lastUpdateTime": 1651411738036,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 2,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "name",
"rawType": "STRING",
"type": "UNKNOWN",
"trinoName": "name",
"description": None,
"tags": [
{
"id": 2,
"creationTime": 1651048111000,
"lastUpdateTime": 1651048111000,
"name": "first_name",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 1,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
},
{
"id": 34,
"creationTime": 1651411738012,
"lastUpdateTime": 1651411738013,
"schemaInfoDetails": {
"id": 1,
"displayName": "adam-test-collibra"
},
"tableInfoDetails": {
"id": 1,
"displayName": "nation"
},
"columnInfoDetails": {
"id": 3,
"creationTime": 1651047171000,
"lastUpdateTime": 1652080042000,
"name": "regionkey",
"rawType": "INT64",
"type": "UNKNOWN",
"trinoName": "regionkey",
"description": None,
"tags": [
{
"id": 5,
"creationTime": 1652080042000,
"lastUpdateTime": 1652080042000,
"name": "region",
"tagLevel": "COLUMN",
"riskFactor": "NONE"
}
],
"ordinal": 2,
"ordinalOverride": None
},
"operationType": "NONE",
"operationPayload": None,
"policyRecommendedOperationType": None,
"policyRecommendedOperationPayload": None,
"riskFactor": "NONE",
"creatorUserId": 4,
"creatorUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
},
"lastUpdateUserId": 4,
"lastUpdateUserDetails": {
"displayName": "Admin Demo",
"profileImageUrl": None,
"roles": [
"ADMIN"
],
"countryIso": "IL",
"id": 4,
"creationTime": 1650970312000,
"lastUpdateTime": 1651046585000
}
}
],
"workflowValues": []
}
],
"paging": {
"start": 0,
"limit": 20,
"total": 5,
"hasMore": False
}
}

flatten_json is a library now, so you can do this. It'll give you 160 columns
from flatten_json import flatten
dic_flattened = (flatten(d, '.') for d in test_json['result'])
df = pd.DataFrame(dic_flattened)
df.shape
(5, 160)

Related

Json file to get out properties

So I have this json output that could be like this. Could be more could be less:
{
"values": [
{
"id": "9207968154959e84a61207773ba595bab4e09a74",
"displayId": "92079681549",
"author": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"authorTimestamp": 1650961815000,
"committer": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"committerTimestamp": 1650961815000,
"message": "fixes sonar issues",
"parents": [
{
"id": "fe037562528e899c2e76c42cd261d227f0884f81",
"displayId": "fe037562528"
}
]
},
{
"id": "9b722800273e421ec4a5add0a4cc624ca04347f0",
"displayId": "9b722800273",
"author": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"authorTimestamp": 1650622775000,
"committer": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"committerTimestamp": 1650622775000,
"message": "removes profiles for testing purpose",
"parents": [
{
"id": "1f1adad1754b064aba630f7df3a8f196dc4478fe",
"displayId": "1f1adad1754"
}
]
},
{
"id": "1f1adad1754b064aba630f7df3a8f196dc4478fe",
"displayId": "1f1adad1754",
"author": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"authorTimestamp": 1650620887000,
"committer": {
"name": "ADBE08",
"emailAddress": "adam.svensson#hotmail.com",
"id": 30405,
"displayName": "Adam svensson",
"active": true,
"slug": "adbe08",
"type": "NORMAL"
},
"committerTimestamp": 1650620887000,
"message": "Merge remote-tracking branch 'origin/feat-KOKO-8243-csca-dd-priv-some-create-purchase-for-test' into feat-debug-menu",
"parents": [
{
"id": "01332cb1374c34aeb2a91b69029f4f4072ea147d",
"displayId": "01332cb1374"
},
{
"id": "8e36ec4b3aacda03b5e52bc8df0c43d44f49c72e",
"displayId": "8e36ec4b3aa"
}
],
"properties": {
"jira-key": [
"KOKO-8243"
]
}
},
{
"id": "8e36ec4b3aacda03b5e52bc8df0c43d44f49c72e",
"displayId": "8e36ec4b3aa",
"author": {
"name": "niol05",
"emailAddress": "anna.olsson#hotmail.com",
"id": 27253,
"displayName": "anna Olsson",
"active": true,
"slug": "niol05",
"type": "NORMAL"
},
"authorTimestamp": 1644848083000,
"committer": {
"name": "niol05",
"emailAddress": "anna.olsson#hotmail.com",
"id": 27253,
"displayName": "anna Olsson",
"active": true,
"slug": "niol05",
"type": "NORMAL"
},
"committerTimestamp": 1644848083000,
"message": "Merge branch 'dev' into feat-KOKO-8243-csca-dd-priv-some-create-purchase-for-test",
"parents": [
{
"id": "633747c469cf488a92f3a29034a47c1f42c1fd81",
"displayId": "633747c469c"
},
{
"id": "1466e5fbfee12dce35fa21c35c157e9ce934ff9e",
"displayId": "1466e5fbfee"
}
],
"properties": {
"jira-key": [
"KOKO-8243"
]
}
},
{
"id": "4b5b85beabb8a7779ab13a5e5de3108103e1cc8b",
"displayId": "4b5b85beabb",
"author": {
"name": "niol05",
"emailAddress": "anna.olsson#hotmail.com",
"id": 27253,
"displayName": "anna Olsson",
"active": true,
"slug": "niol05",
"type": "NORMAL"
},
"authorTimestamp": 1623928598000,
"committer": {
"name": "niol05",
"emailAddress": "anna.olsson#hotmail.com",
"id": 27253,
"displayName": "anna Olsson",
"active": true,
"slug": "niol05",
"type": "NORMAL"
},
"committerTimestamp": 1623928598000,
"message": "Added support for creating test purchase",
"parents": [
{
"id": "7f7da00e46f415fd7f593f0951d04910149ff786",
"displayId": "7f7da00e46f"
}
]
}
],
"size": 5,
"isLastPage": false,
"start": 0,
"limit": 25,
"nextPageStart": 25
}
I want to bring out all info in "jira-key". FX "properties":{"jira-key":["KOKO-13230"]}
Will bring out this commit in a row. Next jira-key commit in a new row.
fx:
KOKO-13230
KOKO-12443
KOKO-3342
KOKO-32142
KOKO-334212
How can I do that. I use bash
You can use jq tool to find all the values.properties.jira-key data. Your example feed to the following command:
jq '.values[].properties?."jira-key"[]?' < example
Will produce:
"KOKO-8243"
"KOKO-8243"
If your json is pretty-printed just like above, you can try also a little bit hackish code using awk:
awk '/]/ { ok=0 } // { if (ok==1) { print $1 } } /"jira-key":/ { ok=1 }' < example
For your example data it should display the same output.

Flutter dynamic data from api to make Widgets

In my case the json will be different every time and i have to make widget like "inputtype": "dropdown", "inputtype": "radiobutton" but if i craete model it don't go as i wants it to.
{
"fields": [
{
"id": 31,
"name": "make",
"isrequired": "required",
"valuetype": "text",
"priority": 1,
"inputtype": "dropdown",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 46,
"name": "Samsung",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:47.000000Z",
"updated_at": "2021-12-29T01:30:47.000000Z",
"priority": 10
},
{
"id": 47,
"name": "Dell",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:30:52.000000Z",
"updated_at": "2021-12-29T01:30:52.000000Z",
"priority": 20
},
{
"id": 48,
"name": "IBM",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:09.000000Z",
"updated_at": "2021-12-29T01:31:09.000000Z",
"priority": 30
},
{
"id": 49,
"name": "Acer",
"categoryextrafield_id": 31,
"created_at": "2021-12-29T01:31:24.000000Z",
"updated_at": "2021-12-29T01:31:24.000000Z",
"priority": 40
}
],
"available": []
},
{
"id": 32,
"name": "model",
"isrequired": "required",
"valuetype": "text",
"priority": 2,
"inputtype": "textfield",
"max_min": [],
"rangeable": "false",
"choices": [],
"available": [
{
"model": "a51"
},
{
"model": "y9s"
},
{
"model": "a31"
},
{
"model": "yS10"
},
{
"model": "Y10S"
},
{
"model": "A551"
},
{
"model": "node8"
},
{
"model": "s9"
},
{
"model": null
},
{
"model": "2021"
},
{
"model": "2020"
},
{
"model": "2010"
},
{
"model": "Civic"
},
{
"model": "2019"
},
{
"model": "Daewooy9"
},
{
"model": "corei5"
},
{
"model": "corei9"
},
{
"model": "corei3"
},
{
"model": "corei11"
}
]
},
{
"id": 29,
"name": "features",
"isrequired": "required",
"valuetype": "text",
"priority": 3,
"inputtype": "checkbox",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 41,
"name": "Bluetooth",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:00.000000Z",
"updated_at": "2021-12-29T01:19:00.000000Z",
"priority": 1
},
{
"id": 42,
"name": "Fingerprint",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:10.000000Z",
"updated_at": "2021-12-29T01:19:10.000000Z",
"priority": 10
},
{
"id": 43,
"name": "LedDisplay",
"categoryextrafield_id": 29,
"created_at": "2021-12-29T01:19:35.000000Z",
"updated_at": "2021-12-29T01:19:35.000000Z",
"priority": 15
}
],
"available": []
},
{
"id": 30,
"name": "condition",
"isrequired": "required",
"valuetype": "text",
"priority": 4,
"inputtype": "radiobutton",
"max_min": [],
"rangeable": "false",
"choices": [
{
"id": 44,
"name": "Used",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:31.000000Z",
"updated_at": "2021-12-29T01:20:31.000000Z",
"priority": 10
},
{
"id": 45,
"name": "New",
"categoryextrafield_id": 30,
"created_at": "2021-12-29T01:20:38.000000Z",
"updated_at": "2021-12-29T01:20:38.000000Z",
"priority": 20
}
],
"available": []
}
]
}

HERE Maps API: How to search for more than 100 places

Here maps provides an API to search for places in the map. If the threshold is not provided, by default, it returns a json with 20 results. However in the json the url to next page of the result is also provided. But with all that I am unable to get more than 100 results in total.
https://places.cit.api.here.com/places/v1/discover/search?app_id=/////myAppId/////&app_code=/////myAppCode/////&q=rewe&in=52.521,13.3807;r=624715.0
q = the search keyword
in = the geo coordinates
r = radius of the area
Result of the call:
{
"results": {
"next": "https://places.cit.api.here.com/places/v1/discover/search;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmb2Zmc2V0PTEwJnNpemU9MTA?in=52.521%2C13.3807%3Br%3D624715.0&q=rewe&app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"items": [{
"position": [
52.52045,
13.38844
],
"distance": 527,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Friedrichstraße 100<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-478f50cd5ded4446a1a0c82616ffdedf;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0w?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-478f50cd5ded4446a1a0c82616ffdedf",
"openingHours": {
"text": "Mon-Sat: 07:00 - 23:30",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT16H30M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.52568,
13.36847
],
"distance": 977,
"title": "Rewe",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Europaplatz 1<br/>Moabit, 10557 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-cea8ce21a43348229139e7ce91e9dcbc;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-cea8ce21a43348229139e7ce91e9dcbc",
"chainIds": [
"1192"
]
},
{
"position": [
52.52961,
13.38399
],
"distance": 983,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Chausseestraße 118<br/>Mitte, 10115 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-1f765b467b8d49a992b787580ee4a583;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0y?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-1f765b467b8d49a992b787580ee4a583",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.51238,
13.39002
],
"distance": 1147,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Friedrichstraße 67<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz0z?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-56fd3ec94cad047f686ce22f4ce9e99d",
"openingHours": {
"text": "Mon-Sat: 08:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT14H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.50813,
13.37448
],
"distance": 1492,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Alte Potsdamer Straße 7<br/>Tiergarten, 10785 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz00?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-dfc2afc7bbd60188a0bc0d07cd441c55",
"openingHours": {
"text": "Mon-Sat: 09:00 - 21:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T090000",
"duration": "PT12H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53245,
13.39711
],
"distance": 1689,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Invalidenstraße 158<br/>Mitte, 10115 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33db-771494bd265e4c97be3e8b2eacb213d1;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz01?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33db-771494bd265e4c97be3e8b2eacb213d1",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53051,
13.4115
],
"distance": 2337,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Schönhauser Allee 10<br/>10119 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33dc-f8d6288526a142d598ad69d3187da0f2;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz02?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33dc-f8d6288526a142d598ad69d3187da0f2",
"openingHours": {
"text": "Mon-Sat: 08:00 - 23:30",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT15H30M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.51866,
13.34227
],
"distance": 2613,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Bartningallee 3<br/>Hansaviertel, 10557 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u336z-9ca5d8c0940348739e8b6f36ae55f973;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz03?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u336z-9ca5d8c0940348739e8b6f36ae55f973",
"openingHours": {
"text": "Mon-Sat: 07:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.49923,
13.36233
],
"distance": 2721,
"title": "REWE City",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Potsdamer Straße 128<br/>Schöneberg, 10783 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276jx7ps-80fed37e7219054ce1c53ab104610624;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz04?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276jx7ps-80fed37e7219054ce1c53ab104610624",
"openingHours": {
"text": "Mon-Sat: 07:00 - 22:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T070000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA"
}]
},
"chainIds": [
"1192"
]
},
{
"position": [
52.53819,
13.41262
],
"distance": 2884,
"title": "REWE",
"averageRating": 0.0,
"category": {
"id": "food-drink",
"title": "Food & Drink",
"href": "https://places.cit.api.here.com/places/v1/categories/places/food-drink?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.cit.data.here.com/p/d/places2_stg/icons/categories/09.icon",
"vicinity": "Schönhauser Allee 36<br/>Prenzlauer Berg, 10435 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/276u33dc-cb9574c5960146b9b30559acf4daf639;context=Zmxvdy1pZD1mYTE1YzhjNC02MWVhLTU4NmItYmE4Yi0zOTUzOWNiMGIyOWFfMTU3MDAyNjYxNTA2MF83NDQ4XzU4MzUmcmFuaz05?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A",
"id": "276u33dc-cb9574c5960146b9b30559acf4daf639",
"openingHours": {
"text": "Mon-Fri: 08:00 - 00:00<br/>Sat: 08:00 - 23:00",
"label": "Opening hours",
"isOpen": true,
"structured": [{
"start": "T080000",
"duration": "PT16H00M",
"recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR"
},
{
"start": "T080000",
"duration": "PT15H00M",
"recurrence": "FREQ:DAILY;BYDAY:SA"
}
]
},
"chainIds": [
"1192"
]
}
]
},
"search": {
"context": {
"location": {
"position": [
52.521,
13.3807
],
"address": {
"text": "Luisenstraße 35<br/>Mitte, 10117 Berlin<br/>Germany",
"house": "35",
"street": "Luisenstraße",
"postalCode": "10117",
"district": "Mitte",
"city": "Berlin",
"county": "Berlin",
"stateCode": "Berlin",
"country": "Germany",
"countryCode": "DEU"
}
},
"type": "urn:nlp-types:place",
"href": "https://places.cit.api.here.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUx1aXNlbnN0cmElQzMlOUZlKzM1O2xhdD01Mi41MjE7bG9uPTEzLjM4MDc7c3RyZWV0PUx1aXNlbnN0cmElQzMlOUZlO2hvdXNlPTM1O2NpdHk9QmVybGluO3Bvc3RhbENvZGU9MTAxMTc7Y291bnRyeT1ERVU7ZGlzdHJpY3Q9TWl0dGU7c3RhdGVDb2RlPUJlcmxpbjtjb3VudHk9QmVybGluO2NhdGVnb3J5SWQ9YnVpbGRpbmc7c291cmNlU3lzdGVtPWludGVybmFs;context=c2VhcmNoQ29udGV4dD0x?app_id=2GIyrHFaa6c5lbFd1nVe&app_code=XOuGHPT2RVvA7SYtcS2z5A"
},
"ranking": "chain"
}
}
I am trying to extract all the franchises of a certain store in the whole area (which is ~3000) but somehow i am not able to get more than 100 results.
Any Solutions to that?
Places API is designed with an end user customer perspective and provides only a limited number of results for a given category. Still for any given category you will be able to get 100 results(maximum). you have to set the size parameter as size=100 to get the maximum(100) result at a time.
http://places.demo.api.here.com/places/v1/discover/around?at=52.521%2C13.3807&cat=hotel&size=100&Accept-Language=en-US%2Cen%3Bq%3D0.5&app_id=&app_code=

How to match a json value with the jq command?

I have the following json data:
{
"item_i7bfe8f00": {
"id": "i7bfe8f00",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 5,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "ALL ITEM STORE",
"title": "Xiaomi Redmi 4A Softcase Black",
"stockTip": {},
"valid": true,
"itemId": "143800088",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100124080",
"price": {
"price": 3500,
"currentPrice": "Rp3.500",
"originPrice": "Rp15.000",
"promotionRatio": "-77%"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Softcase, Hitam",
"productVariant": "SO908ELAAVYY4AANID-72544754",
"brandId": "17818",
"skuId": "157608391"
},
"itemUrl": "https://example.com",
"cartItemId": 2080280320
},
"type": "biz"
},
"item_i7c09dcce": {
"id": "i7c09dcce",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 1,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "PT. Ecart Services Indonesia",
"title": "Black",
"stockTip": {},
"valid": true,
"itemId": "345695828",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100161156",
"price": {
"price": 2499000,
"currentPrice": "Rp2.499.000"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Hitam",
"productVariant": "345695828_ID-359330058",
"brandId": "21734",
"skuId": "359330058"
},
"itemUrl": "https://example.com",
"cartItemId": 2081021134
},
"type": "biz"
}
}
and I want to show the object that only has "cartItemId": 2081021134 so the end result should look like this:
{
"item_i7c09dcce": {
"id": "i7c09dcce",
"tag": "item",
"fields": {
"img": "https://example.com",
"quantity": {
"qtyPrefix": "Kuantitas",
"min": 1,
"autoOptions": false,
"quantity": 1,
"max": 5,
"editable": true,
"showIncrDecr": true,
"showOptions": false,
"step": 1
},
"sellerName": "PT. Ecart Services Indonesia",
"title": "Black",
"stockTip": {},
"valid": true,
"itemId": "345695828",
"operations": [
"wishlist",
"delete"
],
"sellerId": "100161156",
"price": {
"price": 2499000,
"currentPrice": "Rp2.499.000"
},
"restriction": false,
"isGift": false,
"sku": {
"skuText": "Hitam",
"productVariant": "345695828_ID-359330058",
"brandId": "21734",
"skuId": "359330058"
},
"itemUrl": "https://example.com",
"cartItemId": 2081021134
},
"type": "biz"
}
}
This is what I have tried so far :
jq 'select(.cartItemId==2081021134)' input.json
but it returns nothing, how should I fix it ?
You have to go digging a little deeper. Feed the values of the object to select, and check .fields.cartItemId, not just .cartItemId.
jq '.[] | select(.fields.cartItemId == 2081021134)' input.json
This produces the desired output. Using with_entries makes it easy to retain the keys.
with_entries( if .value | has("fields")
then select(.value.fields.cartItemId == 2081021134)
else . end)

Cannot cast parameter REPORT_DATA_SOURCE to net.sf.jasperreports.engine.data.JsonDataSource

I have a Jasper report with a JSON datasource.
My Data Source Expression is:
(net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource()
When I try to see the preview, I get this error:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource()
[...]
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource()
[...]
Caused by: java.lang.ClassCastException: net.sf.jasperreports.engine.fill.SortedDataSource cannot be cast to net.sf.jasperreports.engine.data.JsonDataSource
This is my Json file:
[
{
"appointmentId": 150,
"startDate": 1503039600000,
"patientId": 405,
"patientIdentification": {
"id": 1,
"name": "40295204D"
},
"episodeId": 500349,
"chn": "500046",
"patientName": "Cristina Mayo Saez",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "ENDOCRINOLOGIA",
"benefitId": 28,
"benefitName": "CONSULTA",
"schedule": {
"id": 26,
"name": "Nutrición"
},
"professionalName": "b",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 26,
"name": "Privados"
},
"typeId": 1,
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503037036812
}, {
"appointmentId": 151,
"startDate": 1503039600000,
"patientId": 416,
"patientIdentification": {
"id": 1,
"name": "18466341D"
},
"episodeId": 500350,
"chn": "500057",
"patientName": "Gloria Sena Arrayán",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "NEUROLOGIA",
"benefitId": 45,
"benefitName": "CONSULTA",
"schedule": {
"id": 30,
"name": "Neurologia"
},
"professionalName": "b",
"insurance": {
"id": 1396,
"name": "AGRUPACION MUTUAL ASEGURADORA (AMA)"
},
"collective": {
"id": 30,
"name": "Trafico"
},
"typeId": 1,
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {},
"appoState": {
"id": 4,
"name": "Atendido"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503038643436
}, {
"appointmentId": 153,
"startDate": 1503061200000,
"patientId": 417,
"patientIdentification": {
"id": 1,
"name": "85471254B"
},
"episodeId": 500358,
"chn": "500058",
"patientName": "Aida Mascaró",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "NEUROLOGIA",
"benefitId": 45,
"benefitName": "CONSULTA",
"schedule": {
"id": 30,
"name": "Neurologia"
},
"professionalName": "a",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 26,
"name": "Privados"
},
"typeId": 1,
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {
"id": 3,
"name": "Accidente de trabajo"
},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503057809579
}, {
"appointmentId": 154,
"startDate": 1503298800000,
"patientId": 389,
"patientIdentification": {
"id": 1,
"name": "23234567J"
},
"episodeId": 500359,
"chn": "500030",
"patientName": "maria perez perez",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "ENDOCRINOLOGIA",
"benefitId": 28,
"benefitName": "CONSULTA",
"schedule": {
"id": 26,
"name": "Nutrición"
},
"professionalName": "a",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 26,
"name": "Privados"
},
"typeId": 1,
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {
"id": 2,
"name": "Accidente causal"
},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503297627789
}, {
"appointmentId": 142,
"startDate": 1503298800000,
"patientId": 412,
"episodeId": 500337,
"chn": "500053",
"patientName": "Mariano López Pastor",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "NEUROLOGIA",
"benefitId": 45,
"benefitName": "CONSULTA",
"schedule": {
"id": 30,
"name": "Neurologia"
},
"professionalName": "b",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 25,
"name": "Privados todos"
},
"typeId": 1,
"guarantorStatus": {
"id": 7,
"name": "No requerida"
},
"reason": {},
"appoState": {
"id": 4,
"name": "Atendido"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1502877885393
}, {
"appointmentId": 148,
"startDate": 1503300600000,
"patientId": 415,
"episodeId": 500346,
"chn": "500056",
"patientName": "Pastora Meseguer Carrión",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "NEUROLOGIA",
"benefitId": 45,
"benefitName": "CONSULTA",
"schedule": {
"id": 30,
"name": "Neurologia"
},
"professionalName": "a",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 25,
"name": "Privados todos"
},
"typeId": 1,
"guarantorStatus": {
"id": 7,
"name": "No requerida"
},
"reason": {},
"appoState": {
"id": 4,
"name": "Atendido"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1502885871664
}, {
"appointmentId": 152,
"startDate": 1503302400000,
"patientId": 416,
"patientIdentification": {
"id": 1,
"name": "18466341D"
},
"episodeId": 500351,
"chn": "500057",
"patientName": "Gloria Sena Arrayán",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "NEUROLOGIA",
"benefitId": 46,
"benefitName": "REVISION",
"schedule": {
"id": 30,
"name": "Neurologia"
},
"professionalName": "a",
"insurance": {
"id": 1396,
"name": "AGRUPACION MUTUAL ASEGURADORA (AMA)"
},
"collective": {
"id": 30,
"name": "Trafico"
},
"typeId": 1,
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {},
"appoState": {
"id": 4,
"name": "Atendido"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503038674027
}, {
"appointmentId": 156,
"startDate": 1503302400000,
"patientId": 389,
"patientIdentification": {
"id": 1,
"name": "23234567J"
},
"episodeId": 500361,
"chn": "500030",
"patientName": "maria perez perez",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "PEDIATRIA",
"benefitId": 3,
"benefitName": "CONSULTA",
"schedule": {
"id": 29,
"name": "Dra. De la Vega"
},
"professionalName": "a",
"insurance": {
"id": 1387,
"name": "PRIVADOS"
},
"collective": {
"id": 26,
"name": "Privados"
},
"typeId": 1,
"observations": "obs",
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {
"id": 2,
"name": "Accidente causal"
},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503300374408
}, {
"appointmentId": 158,
"startDate": 1503303300000,
"patientId": 408,
"patientIdentification": {
"id": 2,
"name": "123123"
},
"episodeId": 500363,
"chn": "500049",
"patientName": "ANA CARO MARTINEZ",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "PEDIATRIA",
"benefitId": 3,
"benefitName": "CONSULTA",
"schedule": {
"id": 29,
"name": "Dra. De la Vega"
},
"professionalName": "b",
"insurance": {
"id": 1749,
"name": "ADMIRAL INSURANCE"
},
"collective": {
"id": 13,
"name": "Trafico"
},
"typeId": 1,
"observations": "dewdfe",
"guarantorStatus": {
"id": 1,
"name": "Solicitada"
},
"reason": {
"id": 2,
"name": "Accidente causal"
},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503301904789
}, {
"appointmentId": 159,
"startDate": 1503304200000,
"patientId": 48,
"patientIdentification": {
"id": 5,
"name": "1425871"
},
"episodeId": 500364,
"chn": "186",
"patientName": "cayetana jimenez brotons",
"centerName": "HOSPITAL CLINICA BENIDORM",
"serviceName": "PEDIATRIA",
"benefitId": 4,
"benefitName": "REVISION",
"schedule": {
"id": 29,
"name": "Dra. De la Vega"
},
"professionalName": "b",
"insurance": {
"id": 1390,
"name": "MAPFRE ESPAÑA, CIA. DE SEGUROS Y REASEGUROS S.A."
},
"collective": {
"id": 4,
"name": "MAPFRE SALUD"
},
"typeId": 1,
"observations": "dfd",
"guarantorStatus": {
"id": 7,
"name": "No requerida"
},
"reason": {
"id": 2,
"name": "Accidente causal"
},
"appoState": {
"id": 3,
"name": "Atendiendo"
},
"appoType": {
"id": 1,
"name": "Simple"
},
"professionalCreationName": "Marisol Fernández Lleras",
"creationDate": 1503301999486
}
]
It seems that I can't cast the SortedDataSource into a JsonDataSource. Can anyone help me with this? Thanks.