Encountering an issue while sending JSON data to a WebAPI that contains an image in bytes format - Receiving an error message stating: "The expression is too long or

My experience with JSON is limited, but I'm currently developing a web service that will receive JSON data from an iOS device and insert it into a database.

However, I've encountered an issue with the size of the image byte data which is causing a server-side error stating "An expression is too long or complex to compile."

Below is the JSON data and JavaScript AJAX call:

var source = {
    "longitude": 96.84610000000001,
    "latitude": 35.5608,
    "username": "blah",
    "imageDataBlob": "\/9j... (truncated for readability)"
}

$.ajax({
    type: "POST",
    dataType: "json",
    url: "/api/blah/PostPicture/",
    data: source
});

I need guidance on how to handle such large JSON objects passed to my web service. Are there any web.config settings I can adjust to accommodate this?

Answer №1

In the past, we successfully addressed a comparable problem by segmenting the lengthy string into multiple components, such as imgPart1, imgPart2, imgPart3, and so forth. Afterwards, on the backend, we concatenated all these elements to reconstruct the original string. It might be worth experimenting with this approach.

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

Create a fresh array by merging two existing arrays together

My project involves working with two separate arrays. The first array contains normal date values: var = [ "2022-05-01", "2022-05-02", ... "2022-05-30" ] The second array consists of objects that contain s ...

If using conditional SCSS, consider overriding the variables

When working with React state, I am passing a list and calling the component where needed. comments: { elementLabel: "Comments", elementType: 'textarea', className: "form-control", ...

Having trouble with the JSON parser.equalsIgnoreCase

I am struggling with parsing this JSON value in my app. Every time I try to execute it, the app crashes. Could it be that I am parsing it incorrectly? JSON Data { "NewDataSet": { "Table": { "Company_Code": "1", "Compan ...

Express session not persisting following JQuery Get request

I need to save the server variable that the user inputs. Once they submit, they are directed to another page. On this new page, I check if their server exists and redirect them back if it doesn't. When I make a post request, the session is saved, and ...

Ways to prevent Python errors when reading multiple JSON entries

I am in the process of developing a Python program with a tkinter GUI that can receive user input and append it to a JSON file. The intention is for users to enter a name, which will act as the key for retrieving corresponding data. Currently, I have succe ...

The jQuery window.on event is not functioning when trying to handle the same hash change

How to fix jQuery window.on hashchange issue when clicking on the same hash? See the code snippet below for a potential solution: function addMargin() { let header = $('.header__wrapper').outerHeight(); let headerHeight = $('body& ...

Solving the Dilemma of Ordering Table Rows by Value in JavaScript

I am currently working on a table and my goal is to display rows in an orderly manner based on the sum of their columns. Essentially, I want the rows with the highest values to be displayed first, followed by rows with second highest values, and so on. Des ...

Exploring Nested Views in a MEAN Application using UI Router

I am currently developing a MEAN application and struggling to get my ui-router functioning correctly. Within my index.html template, I have loaded all the necessary javascript and css for my application such as angular, jquery, angular-ui-x, bootstrap. I ...

Generating a JSON file dynamically containing hierarchical data

I am looking to create a JSON file structure similar to the example provided in this post, but I need it to be dynamic. The current solution is specific for "entry1" and "entry2", however, I want the flexibility to use any entity name such as customer, add ...

an unsuccessful attempt to retrieve data was made

After using the fetch function to retrieve a list of notes, nothing appears when I console.log it. I have double-checked the URL and it is correct. Here is the code snippet: import React, { useState, useEffect } from 'react' const NotesListPage ...

Why is it that vanilla HTML/JS (including React) opts for camelCase in its styling conventions, while CSS does not follow the same pattern

Each type of technology for styling has its own set of conventions when it comes to naming properties, with camelCase and hyphenated-style being the two main options. When applying styles directly to an HTML DOM Node using JavaScript, the syntax would be ...

Dynamic links with Node Acl

Utilizing the npm module Acl to establish an ACL system has been my current focus. You can check out the homepage of this module at: https://github.com/OptimalBits/node_acl. While the documentation provides straightforward examples for granting role acces ...

Why isn't Latex rendering when called from Javascript?

Below is the code I'm working with: function test() { document.getElementById('demo').innerHTML="$$\left[ x=0 \right] $$";//same code from demo1.but not rendered } test(); <script type="text/javascript" src="http://latex.co ...

What is the timing for when the SignalR connection is terminated from the browser?

Currently, I am developing a chat application using SignalR 2.0, like many others in the same field. In my Win8.1 application, when the user closes the application, the hub receives the OnDisconnected event and removes the user from the list on the hub. A ...

Obtain information from YouTube and format it into a list item

Currently, I'm working on compiling a list of videos that includes the title, link, image, and creator of each video. It's been a bit challenging :S <script type="text/javascript"> $(document).ready(function(){ $.getJSON('http://gdata ...

What are the steps for implementing pytesseract on a node.js server?

While working on my node.js server, I encountered an issue when using child-process to send an image to a python script. Although I can successfully read the image in the python script, I encounter an error when attempting to convert it to text using pytes ...

Struggling with retrieving data from a JSON file within a Flutter Stateful Widget?

I encountered an issue while loading data from a JSON file. I suspect the problem lies in fetching the data. Any insights on what might be causing this? Although I am not an expert Flutter developer, it's more of a hobby for me so please bear with me ...

Pass data to PHP using AJAX

Is it possible to pass the variable rowNumber to the PHP file dataSource in this code? function getData(dataSource, divID,rowNumber) { if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSo ...

The latest version is available, but remember to update @react-navigation/bottom-tabs, @react-navigation/stack, and @react-navigation/drawer to at least version 5.10.0

As a newcomer to react-native, I am currently attempting to execute a program using expo but encountering a yellow error message. The error states: 'It seems that you are utilizing an outdated version of the react-navigation library. Please ensure th ...

Bootstrap dropdown menu experiencing functionality issues

I am facing an issue with implementing the javascript bootstrap file in my project. The dropdown menu is not working as expected even though I have saved bootstrap to my project folder. I have tried looking at other example codes and even copied and paste ...