Admin
Jan 12, 2023
15 comments
260
ObjectMapper objectMapper = new ObjectMapper(); String containerMatrixJSON = "{\"container_metrics\":{\"cpuRequest\":{\"results\":{\"general_info\":{\"sum\":4.4,\"mean\":1.1,\"units\":\"cores\"}}},\"cpuLimit\":{\"results\":{\"general_info\":{\"su...
Snippet
Java - Convert a JSON or Nested JSON into a Map
Admin
Feb 25, 2022
14 comments
592
2.1. ClassLoader.getResourceAsStream() Use the getResourceAsStream() method to get the InputStream when reading a file from inside a jar file. Always use this method on the ClassLoader instance. private InputStream getFileAsIOStream(final St...
Snippet
Read a file from the ‘resources’ folder
Admin
Feb 09, 2021
19 comments
1.15K
String jsonData = "[\r\n" + " {\r\n" + " \"CompType\": \"Substrate\",\r\n" + " \"CompName\": \"80101-106DSA\",\r\n" + " \"CompRev\": \"BA\",\r\n" + " },\r\n" + " {\r\n" + " \"CompType\": \"Substrate\",\r\n" + " \"CompName\": \...
Snippet
Read JSON data into a list
Admin
Apr 09, 2020
17 comments
363
In JavaScript, you can use following two ways to get hidden field value in a form : document.getElementById(‘hidden field id’).value document.formName.elements[‘hidden field name’].value See an example here… function printIt(){ ...
Snippet
Pass value from JSP to Javascript
Admin
May 26, 2018
4 comments
110
Client Code import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.Socket; public class Client { public static void main (String [] args ) throws IOExc...
Snippet
Sending files over network in Java