The key name for Jackson JSON Processing is specified as "ognl name"

Currently, I am working on a programming project where I have a specific class.

During the process of converting code from Java to JSON, I have a requirement for the key name to be the same as the OGNL (Object Graph Navigation Language) name. For example:

package com.xx.yy;
public Class A{

private String name;

}

As a result, the desired output in JSON format would look like this:

{
"A.name":"value"
}

Answer №1

Here's a solution that should do the trick:

public Class B {

  @JsonProperty("B.title")
  private String getTitle() {
    return title;
  }
}

Check out the Javadoc for @JsonProperty.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for waiting for an HTML element to load in a Selenium JavaScript testing script

I'm struggling to find a way to wait for an element to load in a javascript selenium test script. The closest thing I've come across is until.elementLocated, but it seems to throw an immediate exception. Is there a method to delay throwing the " ...

An unforeseen character appeared amidst the propTypes declaration

Exploring the features of react-boilerplate is a fun experience. The built-in generators are quite handy. For instance, when I decide to generate a new container with all options selected as yes ... ? Select the base component type: React.Component ? Wha ...

Exciting News!! Angular 10 Update: Detecting a Circular Dependency When Injecting a Service into a Specific Module. What Sets @Inject Apart from providers[ ]?

I'm trying to integrate my countries.service into my pricing.module and utilize it within the list-pricing component of that module. However, I encountered a circular dependency issue. https://i.sstatic.net/iNepg.jpg This is how my module looks like ...

What are the best techniques for resizing a bar graph column to perfectly and proportionally match its container size?

Creating a basic bar chart library using vanilla JS and jQuery is what I'm working on. The code below is functional: var userData = { 'Black': 8, 'Latino': 6, 'Native': 4, 'Asian': 10, 'White': 12, & ...

Best location to capture an out of memory exception

Currently facing an issue with a producer-consumer system used for a local bot competition (similar to Scalatron, but more language options and communication via pipes connecting stdin and stdout). The production of items is running smoothly, and the consu ...

Is RaphaelJS truly a vector-based tool?

Is it possible to position a circle at 50% of the width of the canvas using RaphaelJS without having to calculate the exact pixel value? I am looking for a simple way to place an element at half its container's width, but I'm not sure if this can ...

Getting into nested information in a JSON string using TypeScript

I need help accessing the data values (data1, data2, and date) from this JSON structure. I would like to store these values in an array that can be sorted by date: { "07" : { "07" : { "data1" : "-1", "data2" : "test", "date" : "1995-07-07" ...

Is it possible to utilize a field name with a period (".") in my data source when working with ag-grid?

I am encountering an issue with my data source, specifically with fields that have periods in their name. For example: [{ "id": 1234, "OD.name": "Andrew", "OD.age": 21 },{ "id": 1235, "OD.name": "Roofus", "OD.age": 22 }] When I try to b ...

Sharing and displaying images on Sails JS platform

Using Sails JS, I am attempting to upload an image and display it in a view. Queries: The uploaded image is located in .tmp/uploads, how can I retrieve it from a view? Is there a method to access the uploaded image? The image's name is altered in ...

Organizing form data using Vue

One of the features of my code is the ability to create dynamic input and select elements: <div v-for="(index) in rows"> <select> <option selected="true" disabled>Select Type</option> <option>Name</opti ...

Firefox is mistakenly interpreting a pasted image from the clipboard as a string instead of a file, causing

I am facing an issue where I am attempting to extract images from a contenteditable div using the paste event. The code works perfectly in Chrome but does not function as expected in Firefox. I have implemented the following code: $(window).on("paste& ...

Decoding JSON object from the "string" using JSON.parse function

I am attempting to send a JSON string from a PHP controller to a twig template using the following method: $data['dist_result'] = json_encode($distribution_service->setDistribution($ids,$distribution)); $this->display('backend/shipmen ...

Launching application from webpage

For the longest time, I believed that opening a program on a local machine through JavaScript or HTML was impossible due to security concerns. However, in addressing issues with a browser-based POS system, we are considering launching a desktop application ...

Two states each offering a distinct perspective

I am currently working on modularizing my application using angular-ui-router to create a website with two states: main and checkout. In the main state, I want to have multiple "section" tags defined as ui-view items. However, it seems like there is an iss ...

JavaScript - Unusual behavior of Array_Push()

I am experiencing an unusual behavior with Array_Push(). When I add an array to a predefined array, the length of the array unexpectedly increases by two instead of one. Below is the code snippet: Example array: Object {id: 2, firstName: "First name", l ...

Exploring the contrast in functionality between the Link and Anchor tag within the realm of React-router

Personally, I have noticed a trend of using the Link tag instead of the Anchor tag. It seems that the Link tag gets translated into an anchor tag in HTML. However, in my own observations, Link not only renders the page on the client side but also caches it ...

Tap the <li> element in a select2 dropdown from Bootstrap using internjs

I am currently encountering an issue while trying to select values from a Bootstrap-select2 drop-down in my form during the process of writing some function tests. If Select2 is unfamiliar to you, here are some examples that may help: The drop-downs are ...

Can I safely temporarily overwrite a prototype method in a route handler in express?

I'm currently facing a scenario where I have an object containing numerous instances of the Date data type. This object is then converted into JSON format and returned as follows: router.post('/', function () { // Some code that retur ...

How can I configure my controller to pass information to a modal window in MVC5 ASP.NET?

In the midst of developing my ASP.NET web application. First, I will outline the process flow of my app: User submits a form Form data is sent to the controller The controller generates a table filled with numbers using tagbuilder, returning it as mvcHt ...

Delete progeny from Object3D

If I were to instantiate objects using the code below: const group = new THREE.Object3D(); for (let i = 0; i < 10; i++) { const geometry = new THREE.BoxGeometry(1, 1, 1); const material = new THREE.MeshNormalMaterial(); const mesh = new T ...