LinkedHashMap order changed when passed to JSP as JSON - linkedhashmap

I pass a LinkedHashMap (inserted ascending order of value) to JSP as JSON(through AJAX call). When I access this JSON, I see it is ordered by key, rather than by value. What should I do to access this ordered by value?

Related

Is there a way to retrieve realtime firebase map as a linkedhashmap or at least maintain the order it is saved in

I have a map of string boolean pairs saved on firebase realtime database and was wondering if there is a way to retrieve it in kotlin as a linkedhashmap such that the original order remains in place.
I have tried typecasting to a linkedhashmap and got an error that hashmap cannot be typecasted to linked hashmap, I then tried calling the linkedhashmap constructor method with the parameter being the data from the database as a hashmap but that does not maintain the order
Properties in JSON are by definition not in any specific order.
While you can retrieve data from Firebase in a specific order, by calling one of its orderBy... operations, that order will be lost when you call .value in the DataSnapshot as DataSnapshot.value returns a Map, which is unordered again.
If you want to retrieve the nodes in a specific order:
Call orderBy... to get the nodes in a specific order.
Loop over the children of the snapshot you get back to process them in order, and only call value on each specific child node.

Marketo REST API - what is "dedupeFields" for custom objects?

When it comes to creating/updating custom objects, can I use both dedupeFields or lookupField when pushing the data to Marketo?
What is the difference between the two?
I'm not sure what do you mean under lookupField, as there is no such input field described in the API documentation of the Sync Custom Objects endpoint. (That is the endpoint to create or update custom objects.)
In the other hand, you do not need such a standalone lookup field, as with the input array you provide the objects you want to create or update, with all their important values. Have a look at the sample payload in the docs.
When input is used together with the optional dedupeBy and action fields, you have full control over which object you want to create or update.
Also, the endpoint expects the name of the dedupe field under dedupeBy key, as opposed to dedupeFields. So the name is singular; you can provide a single field name use, and it does what you can expect: if the value in the field for a given record is not unique, an error will be returned for the individual record.

Marketo REST API - increment field

If i have a custom object with an integer field, is there a way to send a request to increment this field by 1?
Or would i have to get that field's value, increment it and send it back?
Unfortunately, you cannot increment such a value with a single API call, so you either have to
keep track of your records outside of Marketo too, and update Marketo with the current value;
or you have to use two API calls: one to fetch the record, and a second one to send back the updated value.
Note:
While it is possible to increment/decrement the Score field type (which is also an integer field) with integer values, it is only possible to do so through the Change Score flow step within Marketo. Besides that, the Score type is not available for custom objects.
To be sure, I just have tried to increment an integer value via the API by setting “+1” as a sent value, but it was recorded as plain “1”, so the original record has been overwritten.

What are the options for returning a complex type from a view to a controller in ASP.NET MVC?

I have a model named Order which has a property named Customer. The Customer is a complex object with id, name, balance, etc.
When passing the Order object to a view, the view can access the Customer object and its data as expected. However, when I post back to the Controller, the Order object is populated as expected, but the Customer object is null.
It would be nice if I could add a hidden field in the view for the Customer so it would be included in the post back, but I understand this works for single values not for complex types.
I suppose I could add all the Customer fields to the Order object, but before I do that, is there a way to include the complex object in the postback, or is there a better approach than consolidating the two objects into one by putting the individual Customer fields into the Order type?

Keep ASP.NET ViewState without being passed via QueryString

I have a form with its method being "get" that passes the variables and their values to the query string, respectively. However, it also passes the viewstate variable in the query string. Now, I have a very long viewstate value on the given page, and if passed in the query string, the viewstate variable will cause the page to error out, due to "too long of a query string" which happens to also be too long of a url.
I cannot merely remove the viewstate variable - I need it. But I need to pass the viewstate variable along via some method other than get when the form is submitted, while the other inputs of the form (the non-hidden inputs) are appended to the query string. Is there any way to accomplish this?
Can you change the method to "post" and then use request.form to get your variables?
Otherwise, you might be able to use the session object...
...or a serializable class object
...or a temp table in a database
Several different options

Resources