## Symbolic Representation

To solve the given problem, we first need to convert the natural language description into a symbolic representation.

Let's define the variables:
- $x_1$ = Number of queen size mattresses
- $x_2$ = Number of king size mattresses

The objective function to maximize profit is:
\[ \text{Maximize:} \quad 300x_1 + 500x_2 \]

The constraints based on the given resources are:
\[ 20x_1 + 30x_2 \leq 5000 \] (Foam constraint)
\[ 10x_1 + 15x_2 \leq 2500 \] (Packaging time constraint)
\[ x_1 \geq 0, x_2 \geq 0 \] (Non-negativity constraints)

## Symbolic Representation in JSON Format

```json
{
    'sym_variables': [('x1', 'queen size mattresses'), ('x2', 'king size mattresses')],
    'objective_function': '300*x1 + 500*x2',
    'constraints': [
        '20*x1 + 30*x2 <= 5000',
        '10*x1 + 15*x2 <= 2500',
        'x1 >= 0',
        'x2 >= 0'
    ]
}
```

## Gurobi Code in Python

```python
import gurobipy as gp

# Create a new model
model = gp.Model("Mattress_Production")

# Define the variables
x1 = model.addVar(name="queen_size", lb=0, vtype=gp.GRB.CONTINUOUS)  # Queen size mattresses
x2 = model.addVar(name="king_size", lb=0, vtype=gp.GRB.CONTINUOUS)  # King size mattresses

# Objective function: Maximize profit
model.setObjective(300*x1 + 500*x2, gp.GRB.MAXIMIZE)

# Constraints
model.addConstr(20*x1 + 30*x2 <= 5000, name="foam_constraint")  # Foam constraint
model.addConstr(10*x1 + 15*x2 <= 2500, name="packaging_time_constraint")  # Packaging time constraint

# Solve the model
model.optimize()

# Print the solution
if model.status == gp.GRB.OPTIMAL:
    print(f"Optimal solution: Queen size mattresses = {x1.varValue}, King size mattresses = {x2.varValue}")
    print(f"Maximum profit: ${model.objVal:.2f}")
else:
    print("The model is infeasible.")
```