How to read value from JSON file in Angular11? - json

I want to read value from this JSON file in my Angular application, How can I do that?
(this JSON file is not inside the folder of my application). And I have another problem when I use Angular charts (Pie or LineChart...) in two components it worked in one component and not in the other What's the problem please?
{
"name": "Global Information",
"numberOfRequests": {
"total": 5,
"ok": 0,
"ko": 5
},
"minResponseTime": {
"total": 144,
"ok": 0,
"ko": 144
},
"maxResponseTime": {
"total": 146,
"ok": 0,
"ko": 146
},
"meanResponseTime": {
"total": 145,
"ok": 0,
"ko": 145
},
"standardDeviation": {
"total": 1,
"ok": 0,
"ko": 1
},
"percentiles1": {
"total": 145,
"ok": 0,
"ko": 145
},
"percentiles2": {
"total": 145,
"ok": 0,
"ko": 145
},
"percentiles3": {
"total": 146,
"ok": 0,
"ko": 146
},
"percentiles4": {
"total": 146,
"ok": 0,
"ko": 146
},
"group1": {
"name": "t < 800 ms",
"count": 0,
"percentage": 0
},
"group2": {
"name": "800 ms < t < 1200 ms",
"count": 0,
"percentage": 0
},
"group3": {
"name": "t > 1200 ms",
"count": 0,
"percentage": 0
},
"group4": {
"name": "failed",
"count": 5,
"percentage": 100
},
"meanNumberOfRequestsPerSecond": {
"total": 5.0,
"ok": 0,
"ko": 5.0
}
}

Just add "resolveJsonModule":true in you tsconfig file:
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"declaration": false,
"noImplicitAny": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"strictPropertyInitialization": false,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"resolveJsonModule": true,
"esModuleInterop": true
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictTemplates": true
}
}
Now you can simply import your Json file anywhere.
Import { data } from 'path/to/json/file.json'

Related

I bought the fluxstore program, connects via API to the WordPress site. The program works, but on the emulator it gives such an error

// ignore_for_file: prefer_single_quotes, lines_longer_than_80_chars final
Map<String, dynamic> environment = {
"appConfig": "lib/config/config_en.json",
"serverConfig": {
"url": "https://beno.az",
"type": "dokan",
"consumerKey": "ck_2d0aa8da524a99fee44e48e93b6c27cd278edd0f",
"consumerSecret": "cs_c284c006e0617ddf3b9e9dbabf630a5f1bd0715a"
},
"defaultDarkTheme": false,
"enableRemoteConfigFirebase": false,
"enableFirebaseAnalytics": false,
"loginSMSConstants": {
"nameDefault": "Azərbaycan",
"countryCodeDefault": "AZ",
"dialCodeDefault": "+994"
},
"phoneNumberConfig": {
"useInternationalFormat": true,
"customCountryList": [],
"dialCodeDefault": "+1",
"showCountryFlag": true,
"selectorFlagAsPrefixIcon": true,
"selectorType": "BOTTOM_SHEET",
"countryCodeDefault": "US",
"enablePhoneNumberValidation": false
},
"storeIdentifier": {
"ios": "1469772800",
"disable": true,
"android": "com.inspireui.fluxstore"
},
"advanceConfig": {
"DefaultLanguage": "az",
"DetailedBlogLayout": "halfSizeImageType",
"EnablePointReward": false,
"hideOutOfStock": false,
"HideEmptyTags": true,
"HideEmptyCategories": false,
"EnableRating": true,
"hideEmptyProductListRating": true,
"EnableCart": true,
"ShowBottomCornerCart": true,
"EnableSkuSearch": true,
"showStockStatus": true,
"GridCount": 3,
"isCaching": true,
"kIsResizeImage": true,
"httpCache": true,
"Currencies": [
{
"decimalDigits": 0,
"currency": "AZN",
"currencyCode": "AZN",
"symbolBeforeTheNumber": true,
"symbol": " ₼",
"smallestUnitRate": 1
}
],
"DefaultStoreViewCode": "",
"EnableAttributesConfigurableProduct": ["color", "size"],
"EnableAttributesLabelConfigurableProduct": ["color", "size"],
"isMultiLanguages": true,
"EnableApprovedReview": false,
"EnableSyncCartFromWebsite": false,
"EnableSyncCartToWebsite": false,
"EnableFirebase": false,
"RatioProductImage": 1.2,
"EnableCouponCode": true,
"ShowCouponList": true,
"ShowAllCoupons": true,
"ShowExpiredCoupons": true,
"AlwaysShowTabBar": false,
"PrivacyPoliciesPageId": null,
"PrivacyPoliciesPageUrl": "https://policies.google.com/",
"SupportPageUrl": "https://support.inspireui.com/",
"DownloadPageUrl": "https://mstore.io/#download",
"SocialConnectUrl": [
{
"name": "Facebook",
"url": "https://www.facebook.com/inspireui",
"icon": "assets/icons/logins/facebook.png"
},
{
"url": "https://www.instagram.com/inspireui9/",
"name": "Instagram",
"icon": "assets/icons/logins/instagram.png"
}
],
"AutoDetectLanguage": false,
"QueryRadiusDistance": 10,
"MinQueryRadiusDistance": 1,
"MaxQueryRadiusDistance": 10,
"EnableMembershipUltimate": false,
"EnablePaidMembershipPro": false,
"EnableDeliveryDateOnCheckout": false,
"EnableNewSMSLogin": true,
"EnableBottomAddToCart": false,
"inAppWebView": false,
"EnableWOOCSCurrencySwitcher": false,
"enableProductBackdrop": false,
"categoryImageMenu": true,
"EnableDigitsMobileLogin": false,
"OnBoardOnlyShowFirstTime": true,
"WebViewScript": "",
"EnableVersionCheck": false,
"AjaxSearchURL": "",
"AlwaysClearWebViewCache": false,
"AlwaysRefreshBlog": false,
"OrderNotesWithPrivateNote": true,
"OrderNotesLinkSupport": false,
"inAppUpdateForAndroid": {"typeUpdate": "flexible", "enable": false},
"categoryConfig": {"enableLargeCategories": false, "deepLevel": 3},
"pinnedProductTags": [],
"gdpr": {
"showPrivacyPolicyFirstTime": false,
"showDeleteAccount": true,
"confirmCaptcha": "PERMANENTLY DELETE"
},
"smsLoginAsDefault": false,
"DefaultCurrency": {
"symbolBeforeTheNumber": true,
"currencyCode": "AZN",
"smallestUnitRate": 1,
"decimalDigits": 0,
"symbol": " ₼",
"currency": "AZN"
},
"showRequestNotification": true
},
"defaultDrawer": {
"items": [
{"type": "home", "show": true},
{"show": true, "type": "blog"},
{"show": true, "type": "categories"},
{"type": "cart", "show": true},
{"type": "profile", "show": true},
{"show": true, "type": "login"},
{"show": true, "type": "category"}
],
"logo": "assets/images/logo.png"
},
"defaultSettings": [
"products",
"chat",
"wishlist",
"notifications",
"language",
"currencies",
"darkTheme",
"order",
"point",
"rating",
"privacy",
"about"
],
"loginSetting": {
"showGoogleLogin": true,
"facebookLoginProtocolScheme": "fb430258564493822",
"facebookAppId": "430258564493822",
"smsLoginAsDefault": false,
"showFacebook": false,
"requirePhoneNumberWhenRegister": true,
"showAppleLogin": false,
"showSMSLogin": true,
"facebookClientToken": "",
"isResetPasswordSupported": true,
"showPhoneNumberWhenRegister": true,
"IsRequiredLogin": true
},
"oneSignalKey": {
"appID": "8b45b6db-7421-45e1-85aa-75e597f62714",
"enable": false
},
"onBoardingData": [
{
"image": "https://i.imgur.com/0W12Sg5.png",
"desc": "Allış veriş artıq daha rahat oldu.",
"title": "BEN’O mobil tətbiqinə xoş gəlmisiniz"
},
{
"title": "Çatdırılma",
"image": "https://i.imgur.com/MfOH6LF.png",
"desc": "Siz əziyyət çəkməyin biz çatdırarıq"
},
{
"title": "Yeni dostlar edinin !",
"desc":
"Burada edindiyiniz dostlarınıza sevdiyi hər şeyi rahatlıqla əldə edə bilərsiniz.",
"image": "https://i.imgur.com/xdzO89M.png"
}
],
"vendorOnBoardingData": [
{
"title": "Welcome aboard",
"image": "assets/images/searching.png",
"desc": "Just a few more steps to become our vendor"
},
{
"title": "Let's Get Started",
"image": "assets/images/manage.png",
"desc": "Good Luck for great beginnings."
}
],
"adConfig": {
"ads": [],
"facebookTestingId": "",
"enable": false,
"googleTestingId": [],
"adMobAppIdIos": "ca-app-pub-7432665165146018~2664444130",
"adMobAppIdAndroid": "ca-app-pub-7432665165146018~2664444130"
},
"firebaseDynamicLinkConfig": {
"link": "https://mstore.io/",
"androidPackageName": "com.inspireui.fluxstore",
"uriPrefix": "https://fluxstoreinspireui.page.link",
"iOSAppStoreId": "1469772800",
"androidAppMinimumVersion": 1,
"isEnabled": true,
"iOSBundleId": "com.inspireui.mstore.flutter",
"iOSAppMinimumVersion": "1.0.1",
"shortDynamicLinkEnable": true
},
"languagesInfo": [
{
"icon": "assets/images/country/az.jpg",
"text": "Azərbaycan dili",
"code": "az",
"name": "Azerbaijani",
"storeViewCode": ""
},
{
"text": "English",
"icon": "assets/images/country/gb.png",
"name": "English",
"code": "en",
"storeViewCode": ""
},
{
"storeViewCode": "ru",
"text": "Русский",
"name": "Russian",
"icon": "assets/images/country/ru.png",
"code": "ru"
},
{
"name": "Turkish",
"storeViewCode": "tr",
"text": "Türkçe",
"icon": "assets/images/country/tr.png",
"code": "tr"
}
],
"paymentConfig": {
"excludedPaymentIds": [],
"EnableReview": true,
"EnableAlphanumericZipCode": false,
"EnableOnePageCheckout": true,
"CheckoutPageSlug": {"en": "checkout"},
"EnableRefundCancel": true,
"EnableCustomerNote": true,
"EnableCreditCard": false,
"GuestCheckout": true,
"EnableAddress": true,
"NativeOnePageCheckout": false,
"EnableShipping": true,
"allowSearchingAddress": true,
"SmartCOD": {"amountStop": 200, "enabled": false, "extraFee": 10},
"DefaultStateISOCode": "LA",
"RefundPeriod": 7,
"EnableAddressLocationNote": false,
"ShowOrderNotes": true,
"DefaultCountryISOCode": "AZ",
"UpdateOrderStatus": false
},
"payments": {
"paypal": "assets/icons/payment/paypal.svg",
"stripe_v2_google_pay": "https://i.imgur.com/XAGc92A.jpeg",
"stripe_v2_apple_pay": "https://i.imgur.com/dFQ8FKi.png",
"tap": "assets/icons/payment/tap.png",
"stripe": "assets/icons/payment/stripe.svg",
"razorpay": "assets/icons/payment/razorpay.svg"
},
"stripeConfig": {
"enabled": false,
"paymentMethodIds": ["stripe", "stripe"],
"enableApplePay": true,
"merchantCountryCode": "US",
"paymentMethodId": "stripe",
"serverEndpoint": "https://stripe-server-node.vercel.app",
"merchantDisplayName": "FluxStore",
"merchantIdentifier": "merchant.com.inspireui.mstore.flutter",
"publishableKey":
"pk_test_51HNabPCinksNdU0OwGkZ6uMdZOrLT42NGJkBxmVJwx3oM5mafpJaQRfDHifJMg2iREDZxbPkR1TvDtmBeTyjmgv200mCojR2dG",
"useV1": false,
"enableGooglePay": true,
"returnUrl": "fluxstore://inspireui.com",
"enableManualCapture": false
},
"paypalConfig": {
"secret":
"ECbFREri7NFj64FI_9WzS6A0Az2DqNLrVokBo0ZBu4enHZKMKOvX45v9Y1NBPKFr6QJv2KaSp5vk5A1G",
"nativeMode": false,
"paymentMethodId": "paypal",
"production": false,
"enabled": true,
"clientId":
"ASlpjFreiGp3gggRKo6YzXMyGM6-NwndBAQ707k6z3-WkSSMTPDfEFmNmky6dBX00lik8wKdToWiJj5w"
},
"razorpayConfig": {
"keyId": "rzp_test_SDo2WKBNQXDk5Y",
"enabled": true,
"keySecret": "RrgfT3oxbJdaeHSzvuzaJRZf",
"paymentMethodId": "razorpay"
},
"tapConfig": {
"paymentMethodId": "tap",
"SecretKey": "sk_test_XKokBfNWv6FIYuTMg5sLPjhJ",
"enabled": false
},
"mercadoPagoConfig": {
"production": false,
"enabled": true,
"paymentMethodId": "woo-mercado-pago-basic",
"accessToken":
"TEST-5726912977510261-102413-65873095dc5b0a877969b7f6ffcceee4-613803978"
},
"payTmConfig": {
"production": false,
"enabled": true,
"paymentMethodId": "paytm",
"merchantId": "your-merchant-id"
},
"payStackConfig": {
"enabled": true,
"production": false,
"paymentMethodId": "paystack",
"supportedCurrencies": ["ZAR"],
"publicKey": "pk_test_a1a37615c9ca90dead5dd84dedbb5e476b640a6f"
},
"flutterwaveConfig": {
"publicKey": "FLWPUBK_TEST-72b90e0734da8c9e43916adf63cd711e-X",
"production": false,
"enabled": true,
"paymentMethodId": "rave"
},
"myFatoorahConfig": {
"enabled": false,
"apiToken":
"rLtt6JWvbUHDDhsZnfpAhpYk4dxYDQkbcPTyGaKp2TYqQgG7FGZ5Th_WD53Oq8Ebz6A53njUoo1w3pjU1D4vs_ZMqFiz_j0urb_BH9Oq9VZoKFoJEDAbRZepGcQanImyYrry7Kt6MnMdgfG5jn4HngWoRdKduNNyP4kzcp3mRv7x00ahkm9LAK7ZRieg7k1PDAnBIOG3EyVSJ5kK4WLMvYr7sCwHbHcu4A5WwelxYK0GMJy37bNAarSJDFQsJ2ZvJjvMDmfWwDVFEVe_5tOomfVNt6bOg9mexbGjMrnHBnKnZR1vQbBtQieDlQepzTZMuQrSuKn-t5XZM7V6fCW7oP-uXGX-sMOajeX65JOf6XVpk29DP6ro8WTAflCDANC193yof8-f5_EYY-3hXhJj7RBXmizDpneEQDSaSz5sFk0sV5qPcARJ9zGG73vuGFyenjPPmtDtXtpx35A-BVcOSBYVIWe9kndG3nclfefjKEuZ3m4jL9Gg1h2JBvmXSMYiZtp9MR5I6pvbvylU_PP5xJFSjVTIz7IQSjcVGO41npnwIxRXNRxFOdIUHn0tjQ-7LwvEcTXyPsHXcMD8WtgBh-wxR8aKX7WPSsT1O8d8reb2aR7K3rkV3K82K_0OgawImEpwSvp9MNKynEAJQS6ZHe_J_l77652xwPNxMRTMASk1ZsJL",
"paymentMethodId": "myfatoorah_v2",
"accountCountry": "KW",
"production": false
},
"inAppPurchaseConfig": {
"subscriptionProductIDs": ["com.inspireui.fluxstore.subscription.test"],
"enabled": true,
"consumableProductIDs": ["com.inspireui.fluxstore.test"],
"nonConsumableProductIDs": []
},
"defaultCountryShipping": [],
"afterShip": {
"api": "e2e9bae8-ee39-46a9-a084-781d0139274f",
"tracking_url": "https://fluxstore.aftership.com"
},
"googleApiKey": {
"web": "AIzaSyDSNYVC-8DU9BTcyqkeN9c5pgVhwOBAvGg",
"android": "AIzaSyDSNYVC-8DU9BTcyqkeN9c5pgVhwOBAvGg",
"ios": "AIzaSyDSNYVC-8DU9BTcyqkeN9c5pgVhwOBAvGg"
},
"productDetail": {
"SliderShowGoBackButton": true,
"ForceWhiteBackground": false,
"showQuantityInList": false,
"showProductCategories": true,
"showVideo": true,
"AutoSelectFirstAttribute": true,
"showStockQuantity": true,
"hideInvalidAttributes": false,
"productImageLayout": "page",
"showSku": true,
"SliderIndicatorType": "number",
"autoPlayGallery": false,
"limitDayBooking": 14,
"attributeImagesSize": 50,
"showAddToCartInSearchResult": true,
"productListItemHeight": 125,
"height": 0.6,
"borderRadius": 3,
"showRelatedProduct": true,
"showRelatedProductFromSameStore": true,
"enableReview": true,
"showThumbnailAtLeast": 1,
"marginTop": 0,
"ShowSelectedImageVariant": true,
"ShowImageGallery": true,
"safeArea": false,
"showProductTags": true,
"layout": "simpleType"
},
"blogDetail": {
"showSharing": true,
"showHeart": true,
"enableAudioSupport": false,
"showTextAdjustment": true,
"showComment": true
},
"productVariantLayout": {
"size": "box",
"height": "option",
"color": "color",
"color-image": "image"
},
"productAddons": {
"allowVideoType": true,
"allowCustomType": true,
"fileUploadSizeLimit": 5,
"allowMultiple": false,
"allowImageType": true,
"allowedCustomType": ["png", "pdf", "docx"]
},
"cartDetail": {"minAllowTotalCartValue": 0, "maxAllowQuantity": 20},
"productVariantLanguage": {
"ar": {
"size": "بحجم",
"color-image": "اللون",
"height": "ارتفاع",
"color": "اللون"
},
"vi": {
"color": "Màu",
"height": "Chiều Cao",
"color-image": "Màu",
"size": "Kích thước"
},
"en": {
"height": "Height",
"color-image": "Color",
"size": "Size",
"color": "Color"
}
},
"excludedCategory": 311,
"saleOffProduct": {
"ShowCountDown": true,
"HideEmptySaleOffLayout": false,
"Color": "#C7222B"
},
"notStrictVisibleVariant": true,
"configChat": {
"UseRealtimeChat": false,
"version": "2",
"EnableSmartChat": true,
"showOnScreens": ["profile"],
"hideOnScreens": []
},
"smartChat": [
{
"iconData": "whatsapp",
"imageData": "https://i.imgur.com/tBE2iAn.png",
"app": "https://wa.me/+994506884408",
"description": "WhatsApp"
},
{
"iconData": "phone",
"app": "tel:+994506884408",
"description": "Zəng etmək"
}
],
"adminEmail": "admininspireui#gmail.com",
"adminName": "InspireUI",
"vendorConfig": {
"EnableAutoApplicationApproval": false,
"dokan": "my-account?vendor_admin=true",
"DisableDeliveryManagement": true,
"DisableVendorShipping": false,
"ExpandStoreLocationByDefault": true,
"DefaultStoreImage": "assets/images/default-store-banner.png",
"ShowAllVendorMarkers": true,
"wcfm": "store-manager?vendor_admin=true",
"DisableMultiVendorCheckout": false,
"DisableNativeStoreManagement": true,
"DisablePendingProduct": false,
"BannerFit": "cover",
"NewProductStatus": "draft",
"VendorRegister": true
},
"deliveryConfig": {
"enableSystemNotes": false,
"dashboardName1": "FluxStore",
"dashboardName2": "Delivery",
"appLogo": "assets/images/app_icon_transparent.png",
"appName": "FluxStore Delivery"
},
"managerConfig": {
"enableDeliveryFeature": false,
"appLogo": "assets/images/app_icon_transparent.png",
"appName": "FluxStore Admin"
},
"loadingIcon": {"type": "doubleBounce", "layout": "spinkit"},
"splashScreen": {
"type": "flare",
"paddingBottom": 0,
"animationName": "BEN\"O",
"backgroundColor": "#ffffff",
"duration": 2000,
"paddingTop": 0,
"paddingLeft": 0,
"boxFit": "contain",
"paddingRight": 0,
"enable": true,
"image":
"https://trello.com/1/cards/63d02a96e1774f2f698a187a/attachments/63d038558a12f82d3a6b12d2/download/logo.png"
},
"darkConfig": {
"primaryColorLight": "ff232323",
"MainColor": "ffffffff",
"backgroundColor": "ff232323",
"logo": "https://i.imgur.com/VuUCQJ2.png",
"textColor": "ffffffff"
},
"lightConfig": {
"logo": "https://i.imgur.com/QESdwM5.png",
"MainColor": "ff3fc1be"
},
"enableOnBoarding": true,
"addressFields": [
{
"position": 1,
"required": true,
"editable": true,
"type": "firstName",
"defaultValue": "",
"visible": true
},
{
"visible": true,
"defaultValue": "",
"editable": true,
"type": "lastName",
"position": 2,
"required": true
},
{
"visible": true,
"defaultValue": "",
"position": 3,
"required": true,
"editable": true,
"type": "phoneNumber"
},
{
"position": 4,
"editable": true,
"defaultValue": "",
"type": "email",
"required": true,
"visible": true
},
{"visible": true, "position": 5, "type": "searchAddress"},
{"type": "selectAddress", "visible": true, "position": 6},
{"type": "country", "visible": true, "position": 7},
{"visible": true, "position": 8, "type": "state"},
{
"editable": true,
"visible": true,
"position": 9,
"defaultValue": "",
"required": true,
"type": "city"
},
{
"visible": true,
"type": "apartment",
"editable": true,
"defaultValue": "",
"required": false,
"position": 10
},
{
"defaultValue": "",
"required": false,
"editable": true,
"position": 11,
"visible": true,
"type": "block"
},
{
"type": "street",
"editable": true,
"visible": true,
"position": 12,
"defaultValue": "",
"required": true
},
{
"editable": true,
"position": 13,
"visible": true,
"required": true,
"defaultValue": "",
"type": "zipCode"
}
],
"productCard": {
"showCartButtonWithQuantity": false,
"enableRating": true,
"showCartButton": false,
"hideStore": true,
"hideTitle": false,
"showCartIconColor": false,
"hidePrice": false,
"borderRadius": 3,
"showCartIcon": true,
"boxFit": "cover"
}
};
I bought the fluxstore program, connects via API to the WordPress site. The program works, but on the emulator it gives such an error.
FormatException (FormatException: Unexpected character (at character 1) ‰PNG ^ )
I deleted the entire image on the site but it didn't help. Deleted the Flutter project and reopened it. There are many solutions on the Internet, but I could not change my code in any way, I'm afraid to break the whole application. The program works on the web, but when I open it on the emulator, it gives the above error.

Prettier not working on saving file after vscode update

I have pasted my JSON setting, which may help you to get a deeper knowledge of my problem
when I try to save my file this red box shows and no indentation happens
{
"code-runner.runInTerminal": true,
"code-runner.saveAllFilesBeforeRun": true,
"code-runner.saveFileBeforeRun": true,
"workbench.iconTheme": "vscode-icons",
"C_Cpp.errorSquiggles": "Enabled",
"editor.minimap.enabled": false,
"explorer.confirmDelete": false,
"workbench.startupEditor": "none",
"editor.formatOnSave": true,
"editor.fontSize": 20,
"editor.linkedEditing": true,
"editor.wordWrap": "on",
"explorer.confirmDragAndDrop": false,
"liveServer.settings.donotShowInfoMsg": true,
"editor.formatOnPaste": true,
"highlight-matching-tag.styles": {
"opening": {
"left": {
"underline": "yellow"
},
"right": {
"surround": "#155FFA"
},
"name": {
"highlight": "rgba(180, 20, 80, 0.3)"
}
},
"closing": {
"full": {
"custom": {
"dark": {
"borderWidth": "0 0 3px 0",
"borderColor": "yellow",
"borderStyle": "solid",
"borderRadius": "4px",
"right": "10px"
},
"light": {
"borderWidth": "0 0 3px 0",
"borderColor": "yellow",
"borderStyle": "solid",
"borderRadius": "5px",
"right": "10px"
}
}
}
}
},
"prettier.jsxSingleQuote": true,
"prettier.semi": true,
"prettier.singleQuote": true,
"files.autoSave": "afterDelay",
"liveServer.settings.donotVerifyTags": true,
"workbench.colorTheme": "GitHub Dark",
"window.zoomLevel": 1,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
jglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoo jglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoojglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoojglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoojglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoojglglaoyiughlva oaoiuoya aoiutooya gouyoauoyuaoo
I came up with the solution to my problem by myself, all I had to do was paste the following code in the JSON setting of vs-code for prettier work on HTML and JSON files.
I hope it works for you. cheers
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
}

I can't create a function in PGSQL via concat to get data in a loop over all json

I can't create a function in PGSQL via concat to get data in a loop over all json.
But I want to get data from the database for this json in a loop through all the data from metrics->values->avg and med
Let's say from http_req_duration{scenario:find}->metrics->values->avg and med
JSON structure is like this.
{
"root_group": {
"name": "",
"path": "",
"id": "d41d8cd98f00b204e9800998ecf8427e",
"groups": [],
"checks": [
{
"name": "is joint 200",
"path": "::is joint 200",
"id": "ae8070af06d4849b5a73c0ea09c2238e",
"passes": 12122,
"fails": 0
},
{
"name": "is status 200 find-all",
"path": "::is status 200 find-all",
"id": "bae23285599010636d5dcbc6311a79b6",
"passes": 73852,
"fails": 0
},
{
"passes": 30874,
"fails": 3395,
"name": "is status 200 conditional",
"path": "::is status 200 conditional",
"id": "8f2e67a51bef6111123e1aa04f006a1c"
}
]
},
"options": {
"summaryTrendStats": [
"avg",
"min",
"med",
"max",
"p(90)",
"p(95)"
],
"summaryTimeUnit": "",
"noColor": false
},
"state": {
"isStdOutTTY": false,
"isStdErrTTY": false,
"testRunDurationMs": 345617.874234
},
"metrics": {
"data_received": {
"contains": "data",
"values": {
"count": 106316067,
"rate": 307611.59918488155
},
"type": "counter"
},
"http_req_waiting{scenario:prePubEventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0
},
"thresholds": {
"p(95)<=2": {
"ok": true
},
"avg <= 3": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=2": {
"ok": true
}
}
},
"http_req_blocked{scenario:find}": {
"type": "trend",
"contains": "time",
"values": {
"min": 0.001723,
"med": 0.004228,
"max": 9.42929,
"p(90)": 0.005511,
"p(95)": 0.006082,
"avg": 0.00487203336402536
},
"thresholds": {
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
}
}
},
"http_req_duration{scenario:eventsDriverStop}": {
"thresholds": {
"p(95)<=8": {
"ok": true
},
"avg <= 4": {
"ok": true
},
"med <= 4": {
"ok": true
},
"p(90)<=7": {
"ok": true
}
},
"type": "trend",
"contains": "time",
"values": {
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0,
"avg": 0
}
},
"http_req_waiting{scenario:con}": {
"contains": "time",
"values": {
"med": 0.936649,
"max": 99.55948,
"p(90)": 2.4427536,
"p(95)": 4.682848199999995,
"avg": 1.5082012875777009,
"min": 0.541066
},
"thresholds": {
"avg <= 3": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=4": {
"ok": true
},
"p(95)<=5.8": {
"ok": true
}
},
"type": "trend"
},
"http_req_receiving{scenario:find}": {
"values": {
"max": 15.097094,
"p(90)": 0.066625,
"p(95)": 0.08054044999999994,
"avg": 0.05262911127660761,
"min": 0.013265,
"med": 0.046247
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
},
"type": "trend",
"contains": "time"
},
"iterations{scenario:eventsDriverStop}": {
"values": {
"count": 1201,
"rate": 3.4749360190406846
},
"thresholds": {
"count>0": {
"ok": true
}
},
"type": "counter",
"contains": "default"
},
"vus_max": {
"type": "gauge",
"contains": "default",
"values": {
"value": 249,
"min": 114,
"max": 249
}
},
"dropped_iterations": {
"type": "counter",
"contains": "default",
"values": {
"count": 26803,
"rate": 77.55096596032263
}
},
"http_req_duration{scenario:find}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 1.3326389626144177,
"min": 0.446288,
"med": 0.7976185,
"max": 84.594877,
"p(90)": 2.3167139000000017,
"p(95)": 3.87368795
},
"thresholds": {
"p(95)<=5": {
"ok": true
},
"avg <= 5": {
"ok": true
},
"med <= 3": {
"ok": true
},
"p(90)<=3.5": {
"ok": true
}
}
},
"http_req_sending{scenario:prePubEventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"max": 0,
"p(90)": 0,
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0
},
"thresholds": {
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
}
}
},
"iteration_duration{scenario:con}": {
"type": "trend",
"contains": "time",
"values": {
"p(95)": 612.0240284,
"avg": 603.5558696238289,
"min": 15.970423,
"med": 607.863974,
"max": 657.394861,
"p(90)": 610.6949792
},
"thresholds": {
"avg <= 610": {
"ok": true
},
"med <= 610": {
"ok": true
},
"p(90)<=615": {
"ok": true
},
"p(95)<=620": {
"ok": true
}
}
},
"checks": {
"type": "rate",
"contains": "default",
"values": {
"rate": 0.9717655081792703,
"passes": 116848,
"fails": 3395
}
},
"http_req_sending": {
"type": "trend",
"contains": "time",
"values": {
"med": 0.022442,
"max": 3.47231,
"p(90)": 0.030297,
"p(95)": 0.032682,
"avg": 0.02284295450878623,
"min": 0.006382
}
},
"http_req_receiving{scenario:prePubEventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
}
},
"http_req_sending{scenario:con}": {
"contains": "time",
"values": {
"avg": 0.02357408380752288,
"min": 0.008426,
"med": 0.023204,
"max": 0.356089,
"p(90)": 0.031048,
"p(95)": 0.033433
},
"thresholds": {
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
}
},
"type": "trend"
},
"iteration_duration{scenario:eventsDriverStop}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 1.9972035187343873,
"min": 1.141805,
"med": 1.685224,
"max": 16.105638,
"p(90)": 2.205132,
"p(95)": 5.332459
},
"thresholds": {
"p(95)<=7": {
"ok": true
},
"avg <= 3": {
"ok": true
},
"med <= 3": {
"ok": true
},
"p(90)<=3": {
"ok": true
}
}
},
"http_req_duration{scenario:eventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0,
"avg": 0
},
"thresholds": {
"p(90)<=7": {
"ok": true
},
"p(95)<=8": {
"ok": true
},
"avg <= 4": {
"ok": true
},
"med <= 4": {
"ok": true
}
}
},
"http_req_duration{expected_response:true}": {
"type": "trend",
"contains": "time",
"values": {
"max": 99.649419,
"p(90)": 2.3154703000000003,
"p(95)": 3.958521399999999,
"avg": 1.3774202878354742,
"min": 0.446288,
"med": 0.848834
}
},
"iteration_duration{scenario:cachUpdate}": {
"type": "trend",
"contains": "time",
"values": {
"p(90)": 1.945155,
"p(95)": 5.37025,
"avg": 1.9303337557073827,
"min": 1.010889,
"med": 1.637776,
"max": 13.960856
},
"thresholds": {
"avg <= 3": {
"ok": true
},
"med <= 3": {
"ok": true
},
"p(90)<=3": {
"ok": true
},
"p(95)<=7": {
"ok": true
}
}
},
"http_req_duration{scenario:join}": {
"type": "trend",
"contains": "time",
"values": {
"p(90)": 1.8037868999999997,
"p(95)": 3.272206999999999,
"avg": 1.1918320848869903,
"min": 0.449915,
"med": 0.740105,
"max": 76.250356
},
"thresholds": {
"p(95)<=4": {
"ok": true
},
"avg <= 5": {
"ok": true
},
"med <= 3": {
"ok": true
},
"p(90)<=2.5": {
"ok": true
}
}
},
"http_req_receiving{scenario:cachUpdate}": {
"contains": "time",
"values": {
"max": 0,
"p(90)": 0,
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0
},
"thresholds": {
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
},
"med <= 4": {
"ok": true
},
"p(90)<=1": {
"ok": true
}
},
"type": "trend"
},
"iterations{scenario:prePubEventsDriverStart}": {
"type": "counter",
"contains": "default",
"values": {
"count": 1,
"rate": 0.0028933688751379555
},
"thresholds": {
"count>0": {
"ok": true
}
}
},
"http_req_duration{scenario:prePubEventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0
},
"thresholds": {
"avg <= 45": {
"ok": true
},
"med <= 45": {
"ok": true
},
"p(90)<=45": {
"ok": true
},
"p(95)<=45": {
"ok": true
}
}
},
"http_req_connecting": {
"type": "trend",
"contains": "time",
"values": {
"p(95)": 0,
"avg": 0.0003791068253453424,
"min": 0,
"med": 0,
"max": 9.383985,
"p(90)": 0
}
},
"http_req_receiving": {
"values": {
"avg": 0.052778179752667034,
"min": 0.013265,
"med": 0.046778,
"max": 15.117281,
"p(90)": 0.067176,
"p(95)": 0.08071009999999995
},
"type": "trend",
"contains": "time"
},
"iteration_duration{scenario:join}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 601.8235918496938,
"min": 11.453644,
"med": 606.0548980000001,
"max": 640.327367,
"p(90)": 608.9491829,
"p(95)": 610.87953835
},
"thresholds": {
"avg <= 610": {
"ok": true
},
"med <= 610": {
"ok": true
},
"p(90)<=615": {
"ok": true
},
"p(95)<=620": {
"ok": true
}
}
},
"iterations{scenario:cachUpdate}": {
"contains": "default",
"values": {
"count": 6001,
"rate": 17.363106619702872
},
"thresholds": {
"count>0": {
"ok": true
}
},
"type": "counter"
},
"iteration_duration{scenario:find}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 602.7191305882533,
"min": 12.527132,
"med": 607.5824175,
"max": 659.325018,
"p(90)": 610.23609,
"p(95)": 611.26768395
},
"thresholds": {
"avg <= 610": {
"ok": true
},
"med <=610": {
"ok": true
},
"p(90)<=615": {
"ok": true
},
"p(95)<=620": {
"ok": true
}
}
},
"http_req_waiting{scenario:cachUpdate}": {
"type": "trend",
"contains": "time",
"values": {
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0
},
"thresholds": {
"avg <= 3": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=2": {
"ok": true
},
"p(95)<=2": {
"ok": true
}
}
},
"http_req_blocked{scenario:eventsDriverStop}": {
"type": "trend",
"contains": "time",
"values": {
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0,
"avg": 0
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
}
},
"http_req_blocked{scenario:eventsDriverStart}": {
"type": "trend",
"contains": "time",
"values": {
"p(90)": 0,
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
}
},
"http_req_receiving{scenario:eventsDriverStop}": {
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
},
"type": "trend",
"contains": "time",
"values": {
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0
}
},
"iteration_duration{scenario:prePubEventsDriverStart}": {
"thresholds": {
"max>=0": {
"ok": true
}
},
"type": "trend",
"contains": "time",
"values": {
"min": 41518.762811,
"med": 41518.762811,
"max": 41518.762811,
"p(90)": 41518.762811,
"p(95)": 41518.762811,
"avg": 41518.762811
}
},
"http_req_sending{scenario:cachUpdate}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0,
"p(95)": 0
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 4": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
}
},
"http_req_tls_handshaking": {
"type": "trend",
"contains": "time",
"values": {
"p(90)": 0,
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0
}
},
"iterations": {
"type": "counter",
"contains": "default",
"values": {
"rate": 373.091236342414,
"count": 128947
}
},
"http_req_blocked{scenario:join}": {
"type": "trend",
"contains": "time",
"values": {
"p(95)": 0.006021,
"avg": 0.004797885249958743,
"min": 0.001803,
"med": 0.004248,
"max": 0.44682,
"p(90)": 0.0055209
},
"thresholds": {
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
}
}
},
"http_req_sending{scenario:eventsDriverStop}": {
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
},
"type": "trend",
"contains": "time",
"values": {
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0,
"p(90)": 0
}
},
"http_req_duration{scenario:con}": {
"thresholds": {
"avg <= 5": {
"ok": true
},
"med <= 3": {
"ok": true
},
"p(90)<=3.5": {
"ok": true
},
"p(95)<=6.5": {
"ok": true
}
},
"type": "trend",
"contains": "time",
"values": {
"avg": 1.585340762963596,
"min": 0.584217,
"med": 1.014234,
"max": 99.649419,
"p(90)": 2.5346404,
"p(95)": 4.764954199999999
}
},
"http_req_receiving{scenario:con}": {
"type": "trend",
"contains": "time",
"values": {
"avg": 0.05356539157839449,
"min": 0.014327,
"med": 0.048171,
"max": 15.117281,
"p(90)": 0.06851080000000001,
"p(95)": 0.08132260000000001
},
"thresholds": {
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
},
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
}
}
},
"http_req_blocked{scenario:cachUpdate}": {
"type": "trend",
"contains": "time",
"values": {
"p(90)": 0,
"p(95)": 0,
"avg": 0,
"min": 0,
"med": 0,
"max": 0
},
"thresholds": {
"avg <= 1": {
"ok": true
},
"med <= 1": {
"ok": true
},
"p(90)<=1": {
"ok": true
},
"p(95)<=1": {
"ok": true
}
}
}
}
}
function:
CREATE OR REPLACE FUNCTION public.loaddt_get_metrics(_id integer)
RETURNS text
LANGUAGE plpgsql
AS $function$
declare
_row text;
_output text;
begin
for _row in (select json_object_keys(l.info->'metrics') from loaddt l where l.id = _id) loop -- Правильный получение ключей
_output = concat((select sub.metric->'values'->>'p(90)' as p90, sub.metric->'values'->>'p(95)' as p95, sub.metric->'values'->>'med' as med, sub.metric->'values'->>'avg'
as avg), '|') from (select (l.info->'metrics'->>_row)::json as metric from loaddt l ) sub;
end loop;
return _output;
end;
$function$
;
Error:
SQL Error [42601]: ERROR: subquery must return only one column
Where: PL/pgSQL function loaddt_get_metrics(integer) line 8 at assignment
OR
SQL Error [42601]: ERROR: subquery must return only one column
Where: PL/pgSQL function loaddt_get_metrics(integer) line 7 at assignment
It's not clear from your question what are you trying to achieve, but maybe simple sql would suffice.
Assume you have table loaddt:
create table loaddt(
id int primary key,
info json
);
Then you can replace your loop with a query:
create or replace function loaddt_get_metrics(_id integer)
returns table(key text, output text)
language sql
as $function$
select
js.key as metric,
concat_ws(
'|',
js.value->'values'->>'p(90)',
js.value->'values'->>'p(95)',
js.value->'values'->>'med',
js.value->'values'->>'avg') as output
from loaddt as t, json_each(t.info->'metrics') as js
where t.id = _id
$function$
;

json jq request format

I need help to extract data from this JSON file using jq.
The app flv then verify the streamname mystrame is active and extract meta.video.height
I did try lot of queries without success and my jq knowledge is poor.
{
"port": 1935,
"server_index": 0,
"applications": [{
"name": "hls",
"live": {
"streams": [{
"name": "donbosco",
"time": 2380739,
"bw_in": 2112440,
"bytes_in": 541618713,
"bw_out": 0,
"bytes_out": 0,
"bw_audio": 35544,
"bw_video": 2076888,
"clients": [{
"id": 453,
"address": "127.0.0.1",
"time": 2380959,
"flashver": "FMLE/3.0 (compatible; Lavf57.83.100)",
"dropped": 0,
"avsync": 28,
"timestamp": 2382635,
"publishing": true,
"active": true
}],
"records": [],
"meta": {
"video": {
"width": 1168,
"height": 720,
"frame_rate": 25,
"codec": "H264",
"profile": "High",
"level": 3.1
},
"audio": {
"codec": "AAC",
"profile": "LC",
"channels": 2,
"sample_rate": 16000
}
},
"nclients": 1,
"publishing": true,
"active": true
}],
"nclients": 1
},
"recorders": {
"count": 0,
"lists": []
}
},
{
"name": "flv",
"live": {
"streams": [{
"name": "mystream",
"time": 2382811,
"bw_in": 2059096,
"bytes_in": 541841549,
"bw_out": 2059096,
"bytes_out": 543351459,
"bw_audio": 35472,
"bw_video": 2023624,
"clients": [{
"id": 452,
"address": "127.0.0.1",
"time": 2382727,
"flashver": "LNX 9,0,124,2",
"dropped": 0,
"avsync": -12,
"timestamp": 2384520,
"publishing": false,
"active": true
},
{
"id": 451,
"address": "127.0.0.1",
"time": 2383031,
"flashver": "FMLE/3.0 (compatible; Lavf58.74.100)",
"dropped": 0,
"avsync": -12,
"timestamp": 2384520,
"publishing": true,
"active": true
}
],
"records": [],
"meta": {
"video": {
"width": 1168,
"height": 720,
"frame_rate": 25,
"codec": "H264",
"profile": "High",
"level": 3.1
},
"audio": {
"codec": "AAC",
"profile": "LC",
"channels": 2,
"sample_rate": 16000
}
},
"nclients": 2,
"publishing": true,
"active": true
}],
"nclients": 2
},
"recorders": {
"count": 0,
"lists": []
}
}
]
}
Are you asking for help with the command-line JSON processor jq or the JavaScript library jQuery? They are not the same. For jq, try
jq '
.applications
| map(select(.name == "flv"))[].live.streams
| map(select(.name == "mystream" and .active))[].meta.video.height
'
720
Demo

Cannot read JSON in pandas

I have a nested JSON. I want it to be read in pandas in order to explore it, but I got errors. When to use read_json method, I got: "Trailing data". It is valid JSON. How to read it in pd? (Tried differently, but did not work). It looks like this:
{
"contributors": null,
"coordinates": null,
"created_at": "Fri May 26 08:54:00 +0000 2017",
"entities": {
"hashtags": [],
"media": [
{
"display_url": "pic.twitter.com/Pm28ORTePl",
"expanded_url": "",
"id": 868027417121751040,
"id_str": "868027417121751040",
"indices": [
94,
117
],
"media_url": "",
"sizes": {
"large": {
"h": 404,
"resize": "fit",
"w": 773
},
"medium": {
"h": 404,
"resize": "fit",
"w": 773
},
"small": {
"h": 355,
"resize": "fit",
"w": 680
},
"thumb": {
"h": 150,
"resize": "crop",
"w": 150
}
},
"type": "photo",
"url": ""
}
],
"symbols": [],
"urls": [
{
"display_url": "",
"expanded_url": "",
"indices": [
70,
93
],
"url": ""
}
],
"user_mentions": []
},
"extended_entities": {
"media": [
{
"display_url": "pic.twitter.com/Pm28ORTePl",
"expanded_url": "1",
"id": 868027417121751040,
"id_str": "868027417121751040",
"indices": [
94,
117
],
"media_url": "",
"media_url_https": "",
"sizes": {
"large": {
"h": 404,
"resize": "fit",
"w": 773
},
"medium": {
"h": 404,
"resize": "fit",
"w": 773
},
"small": {
"h": 355,
"resize": "fit",
"w": 680
},
"thumb": {
"h": 150,
"resize": "crop",
"w": 150
}
},
"type": "photo",
"url": ""
}
]
},
"favorite_count": 1,
"favorited": false,
"geo": null,
"id": 868027425757724672,
"id_str": "868027425757724672",
"in_reply_to_screen_name": null,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"is_quote_status": false,
"lang": "ru",
"place": null,
"possibly_sensitive": false,
"retweet_count": 0,
"retweeted": false,
"source": "Twitter Web Client",
"text": "\u041f\u0440\u043e\u043f\u0430\u0432\u0448\u0430\u044f \u0432 \u041a\u043e\u043a\u0448\u0435\u0442\u0430\u0443 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u0446\u0430 \u0436\u0438\u043b\u0430 \u0432 \u0437\u0430\u0431\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043c\u0435 \u0438 \u0431\u0440\u043e\u0434\u044f\u0436\u043d\u0438\u0447\u0430\u043b\u0430\n",
"truncated": false,
"user": {
"contributors_enabled": false,
"created_at": "Wed May 18 11:59:50 +0000 2011",
"default_profile": true,
"default_profile_image": false,
"description": "\u041a\u0430\u0437\u0430\u0445\u0441\u0442\u0430\u043d\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043f\u043e\u0440\u0442\u0430\u043b",
"entities": {
"description": {
"urls": []
},
"url": {
"urls": [
{
"display_url": "",
"expanded_url": "",
"indices": [
0,
22
],
"url": ""
}
]
}
},
"favourites_count": 87,
"follow_request_sent": false,
"followers_count": 17989,
"following": true,
"friends_count": 98,
"geo_enabled": true,
"has_extended_profile": false,
"id": 300811189,
"id_str": "300811189",
"is_translation_enabled": false,
"is_translator": false,
"lang": "ru",
"listed_count": 86,
"location": "\u0410\u043b\u043c\u0430\u0442\u044b",
"name": "",
"notifications": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/300811189/1489117916",
"profile_image_url": "http://pbs.twimg.com/profile_images/840047424882298881/NxZSyfhM_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/840047424882298881/NxZSyfhM_normal.jpg",
"profile_link_color": "1DA1F2",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"protected": false,
"screen_name": "",
"statuses_count": 53011,
"time_zone": "Quito",
"translator_type": "none",
"url": "",
"utc_offset": -18000,
"verified": false
}
}
Sorry, but your JSON is actually not valid, despite your saying it is.
This line:
"media_url": "": "",
Should probably be:
"media_url": "",
At which point, when I added the final bracket } that was outside of your code block, validated as properly formed JSON.