java.net.SocketException: Broken pipe (Write failed) while posting json payload to rest api

Getting java.net.SocketException: Broken pipe (Write failed) while sending json payload arround size of 3.2 mb in size but its intermittent. However for small size it’s working. The code is running on jetty server. I thought there may be memory issue after upgrading server memory with heap size arround 7GB and verified while running this job…

Scala – How to get the Max value of a Json field?

I’m trying to get the maximum value of a MetricId field from a JSON String. However I’m getting a java.lang.UnsupportedOperationException: empty.max for the below String: [{“MetricName”:”name1″,”DateParsed”:”2019-11-20 05:39:00″,”MetricId”:”7855″,”isValid”:”true”}, {“MetricName”:”name2″,”DateParsed”:”2019-05-22 17:45:00″,”MetricId”:”1295″,”isValid”:”false”}] Here is how I’ve implemented a method for finding the Max value: val metricIdRegex = “”””MetricId”\s*:\s*(\d+)”””.r def maxMetricId(jsonString: String): String = { metricIdRegex.findAllIn(jsonString).map({ case metricIdRegex(id) =>…

how to create json object in swift 5

how can i create this json : {“orderItems”:”[{\”product_id\”:19,\”quantity\”:2,\”size_key\”:\” 39 40 42\”},”retailer_id”:20,”status”:”initial”} here is code :– let para:NSMutableDictionary = NSMutableDictionary() let prodArray:NSMutableArray = NSMutableArray() para.setValue(20 , forKey: “retailer_id”) para.setValue(“initial”, forKey: “status”) for product in colorsArray { let prod: NSMutableDictionary = NSMutableDictionary() prod.setValue(product.product?[“id”] , forKey: “product_id”) prod.setValue(“1”, forKey: “quantity”) prod.setValue(variabledata, forKey: “size_key”) prodArray.add(prod) } para.setValue(20 , forKey:…

Convert json file to prometheus metrics

I have nginx json access log like this, a file that append sample like this to end of file. { “time”: “2019-11-27T08:23:39+00:00”, “msec”: 1574843019.787, “ip”: “91.133.248.69”, “agent_name”: “firefox”, “agent_version”: “70”, “agent_os”: “linux”, “agent_os_version”: “”, “agent_category”: “pc”, “agent_vendor”: “mozilla”, “agent_hash”: “5c12a77e”, “geo_country_code”: “IR”, “geo_latitude”: “35.69610”, “geo_longitude”: “51.42310”, “geo_accuracy_radius”: “50”, “geo_continent_name”: “Asia”, “geo_isp”: “Mobile Communication Company of…

Jason Jq filter for the Json response given

JSON response { “uri”: “http://localhost:8081/artifactory/libs-release-local/my/jar/1.0/jar-1.0.jar”, “downloadUri”: “http://localhost:8081/artifactory/libs-release-local/my/jar/1.0/jar-1.0.jar”, “repo”: “libs-release-local”, “path”: “/my/jar/1.0/jar-1.0.jar”, “created”: ISO8601 (yyyy-MM-dd’T’HH:mm:ss.SSSZ), “createdBy”: “userY”, “size”: “1024”, //bytes “mimeType”: “application/java-archive”, “checksums”: { “md5” : string, “sha1” : string }, “originalChecksums”:{ “md5” : string, “sha1” : string } } Jq filter used: jq -r ‘.[].uri’ Result: jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Unix…