json

C# MVC4 Web API - Resulting JSON should return objects instead of $ref to object

[亡魂溺海] 提交于 2021-02-18 11:10:05
问题 I have an ASP.NET MVC 4 Web API app using EntityFramework for ORM. In the JSON I return, there are some cases where the same child node is present for multiple parent nodes. In these cases, the first occurrence of the child node is fully visible with all it's members. Any subsequent occurrence shows up as a $ref to the first occurrence. I'd like instead to see the full object everytime it shows up in the JSON returned. For example, instead of seeing: [{ "$id": "1", "userId": 1, "Badge": { "

Jenkins json REST api with CORS request using jQuery

给你一囗甜甜゛ 提交于 2021-02-18 08:13:55
问题 I'm trying to use the Jenkins json API and cannot get the authentication to work. setup: Jenkins security: Jenkin’s own user database access: Matrix-gebaseerde beveiliging CORS via Jenkins CORS plugin using username/api token of a registered user tried: var username = "username"; var apiToken = "apiToken"; // username / api-token on url (basic authentication) $.ajax({ url: "http://"+username+":"+apiToken+"@host:port/job/test/api/json", method: "GET" }); // username / api-token supplied using

line chart of json data in d3

我与影子孤独终老i 提交于 2021-02-18 06:44:14
问题 I am learning d3. I want to make a line chart using json data. The data I am using is: var data = [ { "at": "2014-11-18T07:29:03.859Z", "value": 0.553292}, { "at": "2014-11-18T07:28:53.859Z", "value": 0.563292}, { "at": "2014-11-18T07:28:43.859Z", "value": 0.573292}, { "at": "2014-11-18T07:28:33.859Z", "value": 0.583292}, { "at": "2014-11-18T07:28:13.859Z", "value": 0.553292}, { "at": "2014-11-18T07:28:03.859Z", "value": 0.563292}]; I want "at" on x axis and "value" on y axis. Also I need to

Determine user input data-type dynamically in JAVA

非 Y 不嫁゛ 提交于 2021-02-18 05:33:10
问题 I've written the following code to determine the data-type of input entered by the user. Update : Removed parsing into Float since a Double value can also be parsed into Float at cost of some precision as mentioned by @DodgyCodeException import java.util.Scanner; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class Main { public static void main(String[] args) { Scanner src = new Scanner(System.in); String input; System.out.println("Enter input:")

One domain model, multiple json views

冷暖自知 提交于 2021-02-18 00:14:07
问题 We have a set of domain classes which are serialized to json via jackson using jersey services. We are currently annotating the classes with JAXB (although we're not tied to that). This works fine. But we want to offer different serializations of the classes for different use cases. Web site Mobile apps Admin tool Public API In each of these cases there are different fields which we may or may not want included in the json view. For example, the admin tool might need some parameters for

Configure Jackson to parse multiple date formats

喜夏-厌秋 提交于 2021-02-17 21:57:28
问题 I am working on a project where the date formats returned in JSON payloads aren't consistent (that's another issue all together). The project I'm working on uses Jackson to parse the JSON responses. Right now I've written a few de/serializers to handle it but it's not elegant. I want to know whether there's a way to configure Jackson with a set of possible date formats to parse for a particular response rather than writing several separate deserializers for each format. Similar to how GSON

Kubernetes / kubectl - “A container name must be specified” but seems like it is?

那年仲夏 提交于 2021-02-17 21:05:11
问题 I'm debugging log output from kubectl that states: Error from server (BadRequest): a container name must be specified for pod postgres-operator-49202276-bjtf4, choose one of: [apiserver postgres-operator] OK, so that's an explanatory error message, but looking at my JSON template it ought to just create both containers specified, correct? What am I missing? (please forgive my ignorance.) I'm using just a standard kubectl create -f command to create the JSON file within a shell script. The

how to export json data to pdf file with specify format with Nodejs?

南楼画角 提交于 2021-02-17 19:44:09
问题 I am a beginner with nodejs. And I am writing a program, which convert text data from json file to pdf file: This is my input file (input.json) { "Info": { "Company": "ABC", "Team": "JsonNode" }, "Number of members": 4, "Time to finish": "1 day" } And I want to convert it to a .pdf (report.pdf) file with following style. Info 1.1 Company ABC 1.2 Team JsonNode Number of members 4 Time to finish 1 day My problems are: 1: How to change style from input.json file to style of report.pdf. 2: How to

Spring configuration properties metadata json for nested list of Objects

我只是一个虾纸丫 提交于 2021-02-17 19:34:06
问题 How does one configure spring configuration metadata json for nested list of objects? Scenario @ConfigurationProperties(prefix = "custom-config") public class ConfigProperties { private boolean booleanProperty; private List<NestedObject> listProperty = new LinkedList<>(); //getters and setters } public class NestedObject { private String stringProperty; private boolean booleanProperty; //getters and setters } This is what was auto generated in the metadata json { "groups": [{ "name": "custom

is boost::property_tree::ptree thread safe?

放肆的年华 提交于 2021-02-17 15:14:36
问题 I'm using boosts read_json in a couple of threads in a piece of code. A simplified breakdown of the call is below. I'm getting segfaults in one of the threads (and sometimes the other) and it's making me think that read_json is not thread safe (Or I'm just using it in a dumb way) void someclass::dojson() { using boost::property_tree::ptree; ptree pt; std::stringstream ss(json_data_string); read_json(ss,pt); } Now json_data_string is different between the two classes (it's just json data